Merge Part 5 (PR#2557)

This commit is contained in:
Richard Wackerbarth 2015-07-31 01:26:09 -05:00
commit d3532bd2a6
33 changed files with 62 additions and 61 deletions

View File

@ -287,6 +287,6 @@ MarlinSerial MSerial;
#endif // !USBCON
// For AT90USB targets use the UART for BT interfacing
#if defined(USBCON) && defined(BTENABLED)
#if defined(USBCON) && ENABLED(BTENABLED)
HardwareSerial bt;
#endif

View File

@ -153,7 +153,7 @@ extern MarlinSerial MSerial;
#endif // !USBCON
// Use the UART for BT in AT90USB configurations
#if defined(USBCON) && defined(BTENABLED)
#if defined(USBCON) && ENABLED(BTENABLED)
extern HardwareSerial bt;
#endif

View File

@ -19,10 +19,10 @@
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "Sd2Card.h"
//------------------------------------------------------------------------------
#ifndef SOFTWARE_SPI
#if DISABLED(SOFTWARE_SPI)
// functions for hardware SPI
//------------------------------------------------------------------------------
// make sure SPCR rate is in expected bits
@ -209,7 +209,7 @@ void Sd2Card::chipSelectHigh() {
}
//------------------------------------------------------------------------------
void Sd2Card::chipSelectLow() {
#ifndef SOFTWARE_SPI
#if DISABLED(SOFTWARE_SPI)
spiInit(spiRate_);
#endif // SOFTWARE_SPI
digitalWrite(chipSelectPin_, LOW);
@ -297,7 +297,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
pinMode(SPI_MOSI_PIN, OUTPUT);
pinMode(SPI_SCK_PIN, OUTPUT);
#ifndef SOFTWARE_SPI
#if DISABLED(SOFTWARE_SPI)
// SS must be in output mode even it is not chip select
pinMode(SS_PIN, OUTPUT);
// set SS high - may be chip select for another SPI device
@ -353,7 +353,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
}
chipSelectHigh();
#ifndef SOFTWARE_SPI
#if DISABLED(SOFTWARE_SPI)
return setSckRate(sckRateID);
#else // SOFTWARE_SPI
return true;
@ -373,7 +373,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
* the value zero, false, is returned for failure.
*/
bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
#ifdef SD_CHECK_AND_RETRY
#if ENABLED(SD_CHECK_AND_RETRY)
uint8_t retryCnt = 3;
// use address if not SDHC card
if (type()!= SD_CARD_TYPE_SDHC) blockNumber <<= 9;
@ -422,7 +422,7 @@ bool Sd2Card::readData(uint8_t *dst) {
return readData(dst, 512);
}
#ifdef SD_CHECK_AND_RETRY
#if ENABLED(SD_CHECK_AND_RETRY)
static const uint16_t crctab[] PROGMEM = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
@ -483,7 +483,7 @@ bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
// transfer data
spiRead(dst, count);
#ifdef SD_CHECK_AND_RETRY
#if ENABLED(SD_CHECK_AND_RETRY)
{
uint16_t calcCrc = CRC_CCITT(dst, count);
uint16_t recvCrc = spiRec() << 8;

View File

@ -19,7 +19,7 @@
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef Sd2Card_h
#define Sd2Card_h
@ -125,7 +125,7 @@ uint8_t const SD_CARD_TYPE_SDHC = 3;
//------------------------------------------------------------------------------
// SPI pin definitions - do not edit here - change in SdFatConfig.h
//
#ifndef SOFTWARE_SPI
#if DISABLED(SOFTWARE_SPI)
// hardware pin defs
/** The default chip select pin for the SD card is SS. */
uint8_t const SD_CHIP_SELECT_PIN = SS_PIN;

View File

@ -21,7 +21,7 @@
#include "Marlin.h"
#include "macros.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef Sd2PinMap_h
#define Sd2PinMap_h

View File

@ -19,7 +19,7 @@
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "SdBaseFile.h"
//------------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef SdBaseFile_h
#define SdBaseFile_h

View File

@ -22,7 +22,7 @@
* \brief configuration definitions
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef SdFatConfig_h
#define SdFatConfig_h

View File

@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef SdFatStructs_h
#define SdFatStructs_h

View File

@ -19,7 +19,7 @@
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "SdFatUtil.h"
//------------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef SdFatUtil_h
#define SdFatUtil_h

View File

@ -19,7 +19,7 @@
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "SdFile.h"
/** Create a file object and open it in the current working directory.
*

View File

@ -23,7 +23,7 @@
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "SdBaseFile.h"
#include <Print.h>
#ifndef SdFile_h

View File

@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef SdInfo_h
#define SdInfo_h

View File

@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#include "SdVolume.h"
//------------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#ifndef SdVolume_h
#define SdVolume_h
/**

View File

@ -3,7 +3,8 @@
Created by Tim Koster, August 21 2013.
*/
#include "Marlin.h"
#ifdef BLINKM
#if ENABLED(BLINKM)
#include "blinkm.h"

View File

@ -5,7 +5,7 @@
#if HAS_BUZZER
void buzz(long duration, uint16_t freq) {
if (freq > 0) {
#ifdef LCD_USE_I2C_BUZZER
#if ENABLED(LCD_USE_I2C_BUZZER)
lcd_buzz(duration, freq);
#elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition
SET_OUTPUT(BEEPER);

View File

@ -5,7 +5,7 @@
#include "temperature.h"
#include "language.h"
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
CardReader::CardReader() {
filesize = 0;
@ -128,7 +128,7 @@ void CardReader::ls() {
lsDive("", root);
}
#ifdef LONG_FILENAME_HOST_SUPPORT
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
/**
* Get a long pretty path based on a DOS 8.3 path
@ -195,7 +195,7 @@ void CardReader::initsd() {
cardOK = false;
if (root.isOpen()) root.close();
#ifdef SDSLOW
#if ENABLED(SDSLOW)
#define SPI_SPEED SPI_HALF_SPEED
#else
#define SPI_SPEED SPI_FULL_SPEED

View File

@ -1,7 +1,7 @@
#ifndef CARDREADER_H
#define CARDREADER_H
#ifdef SDSUPPORT
#if ENABLED(SDSUPPORT)
#define MAX_DIR_DEPTH 10 // Maximum folder depth
@ -28,7 +28,7 @@ public:
void getStatus();
void printingHasFinished();
#ifdef LONG_FILENAME_HOST_SUPPORT
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
void printLongPath(char *path);
#endif
@ -82,7 +82,7 @@ extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1)
#ifdef SDCARDDETECTINVERTED
#if ENABLED(SDCARDDETECTINVERTED)
#define IS_SD_INSERTED (READ(SDCARDDETECT) != 0)
#else
#define IS_SD_INSERTED (READ(SDCARDDETECT) == 0)

View File

@ -37,7 +37,7 @@
#define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
#endif
#ifdef HAS_AUTOMATIC_VERSIONING
#if ENABLED(HAS_AUTOMATIC_VERSIONING)
#include "_Version.h"
#endif
@ -216,7 +216,7 @@
// LCD Menu Messages
#if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILLIC ))
#if DISABLED(DISPLAY_CHARSET_HD44780_JAPAN) && DISABLED(DISPLAY_CHARSET_HD44780_WESTERN) && DISABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
#define DISPLAY_CHARSET_HD44780_JAPAN
#endif

View File

@ -1,6 +1,6 @@
#include "Configuration.h"
#ifdef DIGIPOT_I2C
#if ENABLED(DIGIPOT_I2C)
#include "Stream.h"
#include "utility/twi.h"

View File

@ -3,7 +3,7 @@
// Please note that using the high-res version takes 402Bytes of PROGMEM.
//#define START_BMPHIGH
#ifdef START_BMPHIGH
#if ENABLED(START_BMPHIGH)
#define START_BMPWIDTH 112
#define START_BMPHEIGHT 38
#define START_BMPBYTEWIDTH 14

View File

@ -1,6 +1,6 @@
#include "mesh_bed_leveling.h"
#ifdef MESH_BED_LEVELING
#if ENABLED(MESH_BED_LEVELING)
mesh_bed_leveling mbl;

View File

@ -1,6 +1,6 @@
#include "Marlin.h"
#ifdef MESH_BED_LEVELING
#if ENABLED(MESH_BED_LEVELING)
#define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1))
#define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1))

View File

@ -1,6 +1,6 @@
#include "qr_solve.h"
#ifdef AUTO_BED_LEVELING_GRID
#if ENABLED(AUTO_BED_LEVELING_GRID)
#include <stdlib.h>
#include <math.h>

View File

@ -1,6 +1,6 @@
#include "Configuration.h"
#ifdef AUTO_BED_LEVELING_GRID
#if ENABLED(AUTO_BED_LEVELING_GRID)
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
double ddot ( int n, double dx[], int incx, double dy[], int incy );

View File

@ -42,10 +42,10 @@
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
*/
#include "Configuration.h"
#ifdef NUM_SERVOS
#if HAS_SERVOS
#include <avr/interrupt.h>
#include <Arduino.h>
@ -103,29 +103,29 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
// Interrupt handlers for Arduino
#ifdef _useTimer1
#if ENABLED(_useTimer1)
SIGNAL (TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
#endif
#ifdef _useTimer3
#if ENABLED(_useTimer3)
SIGNAL (TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
#endif
#ifdef _useTimer4
#if ENABLED(_useTimer4)
SIGNAL (TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
#endif
#ifdef _useTimer5
#if ENABLED(_useTimer5)
SIGNAL (TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
#endif
#else //!WIRING
// Interrupt handlers for Wiring
#ifdef _useTimer1
#if ENABLED(_useTimer1)
void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
#endif
#ifdef _useTimer3
#if ENABLED(_useTimer3)
void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
#endif
@ -133,7 +133,7 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
static void initISR(timer16_Sequence_t timer) {
#ifdef _useTimer1
#if ENABLED(_useTimer1)
if (timer == _timer1) {
TCCR1A = 0; // normal counting mode
TCCR1B = _BV(CS11); // set prescaler of 8
@ -152,7 +152,7 @@ static void initISR(timer16_Sequence_t timer) {
}
#endif
#ifdef _useTimer3
#if ENABLED(_useTimer3)
if (timer == _timer3) {
TCCR3A = 0; // normal counting mode
TCCR3B = _BV(CS31); // set prescaler of 8
@ -170,7 +170,7 @@ static void initISR(timer16_Sequence_t timer) {
}
#endif
#ifdef _useTimer4
#if ENABLED(_useTimer4)
if (timer == _timer4) {
TCCR4A = 0; // normal counting mode
TCCR4B = _BV(CS41); // set prescaler of 8
@ -180,7 +180,7 @@ static void initISR(timer16_Sequence_t timer) {
}
#endif
#ifdef _useTimer5
#if ENABLED(_useTimer5)
if (timer == _timer5) {
TCCR5A = 0; // normal counting mode
TCCR5B = _BV(CS51); // set prescaler of 8

View File

@ -3,7 +3,7 @@
#include "Marlin.h"
#ifdef U8GLIB_ST7920
#if ENABLED(U8GLIB_ST7920)
//set optimization so ARDUINO optimizes this file
#pragma GCC optimize (3)

View File

@ -19,7 +19,7 @@
#include <math.h>
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
#include "vector_3.h"
vector_3::vector_3() : x(0), y(0), z(0) { }

View File

@ -19,7 +19,7 @@
#ifndef VECTOR_3_H
#define VECTOR_3_H
#ifdef ENABLE_AUTO_BED_LEVELING
#if ENABLED(ENABLE_AUTO_BED_LEVELING)
class matrix_3x3;
struct vector_3

View File

@ -1,6 +1,6 @@
#include "Marlin.h"
#ifdef USE_WATCHDOG
#if ENABLED(USE_WATCHDOG)
#include <avr/wdt.h>
#include "watchdog.h"
@ -18,15 +18,15 @@
/// intialise watch dog with a 4 sec interrupt time
void watchdog_init()
{
#ifdef WATCHDOG_RESET_MANUAL
#if ENABLED(WATCHDOG_RESET_MANUAL)
//We enable the watchdog timer, but only for the interrupt.
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
wdt_reset();
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
_WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
#else
#else
wdt_enable(WDTO_4S);
#endif
#endif
}
/// reset watchdog. MUST be called every 1s after init or avr will reset.
@ -40,7 +40,7 @@ void watchdog_reset()
//===========================================================================
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
#ifdef WATCHDOG_RESET_MANUAL
#if ENABLED(WATCHDOG_RESET_MANUAL)
ISR(WDT_vect)
{
SERIAL_ERROR_START;

View File

@ -3,7 +3,7 @@
#include "Marlin.h"
#ifdef USE_WATCHDOG
#if ENABLED(USE_WATCHDOG)
// initialize watch dog with a 1 sec interrupt time
void watchdog_init();
// pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..