Commit 86d3dd96 authored by MagoKimbra's avatar MagoKimbra

Update code

parent ba8f964e
......@@ -123,17 +123,29 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
// Use one of these defines to specify the origin
// for a topographical map to be printed for your bed.
enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
#define TOPO_ORIGIN OriginFrontLeft
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
// Set the number of grid points per dimension
// You probably don't need more than 3 (squared=9)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to estimate the plane of the print bed
// Arbitrary points to probe. A simple cross-product
// is used to estimate the plane of the bed.
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
......
......@@ -123,17 +123,29 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
// Use one of these defines to specify the origin
// for a topographical map to be printed for your bed.
enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
#define TOPO_ORIGIN OriginFrontLeft
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
// Set the number of grid points per dimension
// You probably don't need more than 3 (squared=9)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to estimate the plane of the print bed
// Arbitrary points to probe. A simple cross-product
// is used to estimate the plane of the bed.
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
......
......@@ -147,17 +147,29 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define AUTO_BED_LEVELING_GRID
#ifdef AUTO_BED_LEVELING_GRID
// Use one of these defines to specify the origin
// for a topographical map to be printed for your bed.
enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
#define TOPO_ORIGIN OriginFrontLeft
#define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
// Set the number of grid points per dimension
// You probably don't need more than 3 (squared=9)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to estimate the plane of the print bed
// Arbitrary points to probe. A simple cross-product
// is used to estimate the plane of the bed.
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
......
......@@ -32,6 +32,9 @@
#include "WProgram.h"
#endif
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
// Arduino < 1.0.0 does not define this, so we need to do it ourselves
#ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p) + 0xA0)
......
......@@ -76,7 +76,7 @@ void MarlinSerial::begin(long baud) {
#endif
if (useU2X) {
M_UCSRxA = 1 << M_U2Xx;
M_UCSRxA = BIT(M_U2Xx);
baud_setting = (F_CPU / 4 / baud - 1) / 2;
} else {
M_UCSRxA = 0;
......
......@@ -97,14 +97,14 @@ class MarlinSerial { //: public Stream
}
FORCE_INLINE void write(uint8_t c) {
while (!((M_UCSRxA) & (1 << M_UDREx)))
while (!TEST(M_UCSRxA, M_UDREx))
;
M_UDRx = c;
}
FORCE_INLINE void checkRx(void) {
if ((M_UCSRxA & (1<<M_RXCx)) != 0) {
if (TEST(M_UCSRxA, M_RXCx)) {
unsigned char c = M_UDRx;
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
......
This diff is collapsed.
......@@ -35,14 +35,14 @@
*/
static void spiInit(uint8_t spiRate) {
// See avr processor documentation
SPCR = (1 << SPE) | (1 << MSTR) | (spiRate >> 1);
SPSR = spiRate & 1 || spiRate == 6 ? 0 : 1 << SPI2X;
SPCR = BIT(SPE) | BIT(MSTR) | (spiRate >> 1);
SPSR = spiRate & 1 || spiRate == 6 ? 0 : BIT(SPI2X);
}
//------------------------------------------------------------------------------
/** SPI receive a byte */
static uint8_t spiRec() {
SPDR = 0XFF;
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
return SPDR;
}
//------------------------------------------------------------------------------
......@@ -52,18 +52,18 @@ void spiRead(uint8_t* buf, uint16_t nbyte) {
if (nbyte-- == 0) return;
SPDR = 0XFF;
for (uint16_t i = 0; i < nbyte; i++) {
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
buf[i] = SPDR;
SPDR = 0XFF;
}
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
buf[nbyte] = SPDR;
}
//------------------------------------------------------------------------------
/** SPI send a byte */
static void spiSend(uint8_t b) {
SPDR = b;
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
}
//------------------------------------------------------------------------------
/** SPI send block - only one call so force inline */
......@@ -71,12 +71,12 @@ static inline __attribute__((always_inline))
void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
SPDR = buf[i];
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
SPDR = buf[i + 1];
}
while (!(SPSR & (1 << SPIF))) { /* Intentionally left empty */ }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
}
//------------------------------------------------------------------------------
#else // SOFTWARE_SPI
......
......@@ -334,9 +334,9 @@ static inline __attribute__((always_inline))
void setPinMode(uint8_t pin, uint8_t mode) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (mode) {
*digitalPinMap[pin].ddr |= 1 << digitalPinMap[pin].bit;
*digitalPinMap[pin].ddr |= BIT(digitalPinMap[pin].bit);
} else {
*digitalPinMap[pin].ddr &= ~(1 << digitalPinMap[pin].bit);
*digitalPinMap[pin].ddr &= ~BIT(digitalPinMap[pin].bit);
}
} else {
badPinNumber();
......@@ -354,9 +354,9 @@ static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, uint8_t value) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (value) {
*digitalPinMap[pin].port |= 1 << digitalPinMap[pin].bit;
*digitalPinMap[pin].port |= BIT(digitalPinMap[pin].bit);
} else {
*digitalPinMap[pin].port &= ~(1 << digitalPinMap[pin].bit);
*digitalPinMap[pin].port &= ~BIT(digitalPinMap[pin].bit);
}
} else {
badPinNumber();
......
......@@ -171,9 +171,9 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) {
return 2*(fatTime & 0X1F);
}
/** Default date for file timestamps is 1 Jan 2000 */
uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | BIT(5) | 1;
/** Default time for file timestamp is 1 am */
uint16_t const FAT_DEFAULT_TIME = (1 << 11);
uint16_t const FAT_DEFAULT_TIME = BIT(11);
//------------------------------------------------------------------------------
/**
* \class SdBaseFile
......
......@@ -360,7 +360,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
blocksPerCluster_ = fbs->sectorsPerCluster;
// determine shift that is same as multiply by blocksPerCluster_
clusterSizeShift_ = 0;
while (blocksPerCluster_ != (1 << clusterSizeShift_)) {
while (blocksPerCluster_ != BIT(clusterSizeShift_)) {
// error if not power of 2
if (clusterSizeShift_++ > 7) goto fail;
}
......
......@@ -24,9 +24,9 @@
#define BLEN_A 0
#define BLEN_B 1
#define BLEN_C 2
#define EN_A (1<<BLEN_A)
#define EN_B (1<<BLEN_B)
#define EN_C (1<<BLEN_C)
#define EN_A BIT(BLEN_A)
#define EN_B BIT(BLEN_B)
#define EN_C BIT(BLEN_C)
#define LCD_CLICKED (buttons&EN_C)
#endif
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Amortar motors"
#define MSG_AUTO_HOME "Levar a l'orichen"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Establir zero"
#define MSG_PREHEAT_PLA "Precalentar PLA"
......@@ -49,9 +56,9 @@
#define MSG_FAN_SPEED "Ixoriador"
#define MSG_FLOW "Fluxo"
#define MSG_CONTROL "Control"
#define MSG_MIN "\002 Min"
#define MSG_MAX "\002 Max"
#define MSG_FACTOR "\002 Fact"
#define MSG_MIN " " STR_THERMOMETER " Min"
#define MSG_MAX " " STR_THERMOMETER " Max"
#define MSG_FACTOR " " STR_THERMOMETER " Fact"
#define MSG_AUTOTEMP "Autotemp"
#define MSG_ON "On"
#define MSG_OFF "Off"
......@@ -82,7 +89,7 @@
#define MSG_TEMPERATURE "Temperatura"
#define MSG_MOTION "Movimiento"
#define MSG_VOLUMETRIC "Filament"
#define MSG_VOLUMETRIC_ENABLED "E in mm3"
#define MSG_VOLUMETRIC_ENABLED "E in mm" STR_h3
#define MSG_FILAMENT_SIZE_EXTRUDER "Fil. Dia."
#define MSG_CONTRAST "Contrast"
#define MSG_STORE_EPROM "Alzar Memoria"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Apagar motors"
#define MSG_AUTO_HOME "Home global"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Establir origen"
#define MSG_PREHEAT_PLA "Preescalfar PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Stepper abschalt."
#define MSG_AUTO_HOME "Auto Nullpunkt"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Setze Nullpunkt"
#define MSG_PREHEAT_PLA "Vorwärmen PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Disable steppers"
#define MSG_AUTO_HOME "Auto home"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Set origin"
#define MSG_PREHEAT_PLA "Preheat PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Apagar motores"
#define MSG_AUTO_HOME "Llevar al origen"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Ajustar offsets"
#define MSG_SET_ORIGIN "Establecer cero"
#define MSG_PREHEAT_PLA "Precalentar PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Itzali motoreak"
#define MSG_AUTO_HOME "Hasierara joan"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Hasiera ipini"
#define MSG_PREHEAT_PLA "Aurreberotu PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Vapauta moottorit"
#define MSG_AUTO_HOME "Aja referenssiin"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Aseta origo"
#define MSG_PREHEAT_PLA "Esil" STR_ae "mmit" STR_ae " PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Arreter moteurs"
#define MSG_AUTO_HOME "Home auto."
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Regler origine"
#define MSG_PREHEAT_PLA "Prechauffage PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Disabilita Motori"
#define MSG_AUTO_HOME "Auto Home"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Setta offset home"
#define MSG_SET_ORIGIN "Imposta Origine"
#define MSG_PREHEAT_PLA "Preriscalda PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Motoren uit"
#define MSG_AUTO_HOME "Auto home"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Nulpunt instellen"
#define MSG_PREHEAT_PLA "PLA voorverwarmen"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Wylacz silniki"
#define MSG_AUTO_HOME "Auto. poz. zerowa"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Ustaw punkt zero"
#define MSG_PREHEAT_PLA "Rozgrzej PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS " Apagar motores"
#define MSG_AUTO_HOME "Ir para origen"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Estabelecer orig."
#define MSG_PREHEAT_PLA "Pre-aquecer PLA"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS " Desligar motores"
#define MSG_AUTO_HOME "Ir para home"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Def. home offsets"
#define MSG_SET_ORIGIN "Estabelecer orig."
#define MSG_PREHEAT_PLA "Pre-aquecer PLA"
......@@ -44,14 +51,14 @@
#define MSG_MOVE_1MM "Mover 1mm"
#define MSG_MOVE_10MM "Mover 10mm"
#define MSG_SPEED "Velocidade"
#define MSG_NOZZLE "\002Bico"
#define MSG_BED "\002Base"
#define MSG_NOZZLE "Bico"
#define MSG_BED "Base"
#define MSG_FAN_SPEED "Velocidade do ar."
#define MSG_FLOW "Fluxo"
#define MSG_CONTROL "Controlo \003"
#define MSG_MIN "\002 Min"
#define MSG_MAX "\002 Max"
#define MSG_FACTOR "\002 Fact"
#define MSG_CONTROL "Control"
#define MSG_MIN " " STR_THERMOMETER " Min"
#define MSG_MAX " " STR_THERMOMETER " Max"
#define MSG_FACTOR " " STR_THERMOMETER " Fact"
#define MSG_AUTOTEMP "Autotemp"
#define MSG_ON "On "
#define MSG_OFF "Off"
......
......@@ -16,6 +16,13 @@
#define MSG_DISABLE_STEPPERS "Выкл. двигатели"
#define MSG_AUTO_HOME "Парковка"
#define MSG_BED_SETTING "Bed Setting"
#define MSG_LP_INTRO " Leveling bed... Press to start "
#define MSG_LP_1 " Adjust first point & Press the button"
#define MSG_LP_2 " Adjust second point & Press the button"
#define MSG_LP_3 " Adjust third point & Press the button"
#define MSG_LP_4 " Adjust fourth point & Press the button"
#define MSG_LP_5 " Is it ok? Press to end"
#define MSG_LP_6 " BED leveled!"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Запомнить ноль"
#define MSG_PREHEAT_PLA "Преднагрев PLA"
......
......@@ -4363,6 +4363,8 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#endif // 99
/****************************************************************************************/
/****************************************************************************************
********************************* END MOTHERBOARD ***************************************
/****************************************************************************************/
......@@ -4371,52 +4373,6 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#error Unknown MOTHERBOARD value in configuration.h
#endif
/****************************************************************************************
************************************* FEATURE *******************************************
/****************************************************************************************/
#ifdef SINGLENOZZLE
#undef HEATER_1_PIN
#undef HEATER_2_PIN
#undef HEATER_3_PIN
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_3_PIN -1
#undef TEMP_1_PIN
#undef TEMP_2_PIN
#undef TEMP_3_PIN
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_3_PIN -1
#endif //SINGLENOZZLE
#ifdef MKR4
#if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS==1) // Use this for one driver and two extruder
#define E0E1_CHOICE_PIN 5
#elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS==2) // Use this for two driver and 3 extruder
#define E0E2_CHOICE_PIN 5
#elif (EXTRUDERS == 4) && (DRIVER_EXTRUDERS==2) // Use this for two driver and 4 extruder
#define E0E2_CHOICE_PIN 5
#define E1E3_CHOICE_PIN 6
#endif //EXTRUDERS
#endif //MKR4
#ifdef NPR2
#define E_MIN_PIN 19
#endif //NPR2
#ifdef LASERBEAM
#define LASER_PWR_PIN 42
#define LASER_TTL_PIN 44
#endif
#ifdef FILAMENT_END_SWITCH
#define PAUSE_PIN 19
#endif
/****************************************************************************************/
#ifndef HEATER_1_PIN
#define HEATER_1_PIN -1
#endif
......@@ -4485,6 +4441,54 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define Z_MAX_PIN -1
#endif //Z_HOME_DIR > 0
#endif //!DELTA
/****************************************************************************************/
/****************************************************************************************
************************************* FEATURE *******************************************
/****************************************************************************************/
#ifdef SINGLENOZZLE
#undef HEATER_1_PIN
#undef HEATER_2_PIN
#undef HEATER_3_PIN
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_3_PIN -1
#undef TEMP_1_PIN
#undef TEMP_2_PIN
#undef TEMP_3_PIN
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_3_PIN -1
#endif //SINGLENOZZLE
#ifdef MKR4
#if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS==1) // Use this for one driver and two extruder
#define E0E1_CHOICE_PIN 5
#elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS==2) // Use this for two driver and 3 extruder
#define E0E2_CHOICE_PIN 5
#elif (EXTRUDERS == 4) && (DRIVER_EXTRUDERS==2) // Use this for two driver and 4 extruder
#define E0E2_CHOICE_PIN 5
#define E1E3_CHOICE_PIN 6
#endif //EXTRUDERS
#endif //MKR4
#ifdef NPR2
#define E_MIN_PIN 19
#endif //NPR2
#ifdef LASERBEAM
#define LASER_PWR_PIN 42
#define LASER_TTL_PIN 44
#endif
#ifdef FILAMENT_END_SWITCH
#define PAUSE_PIN 19
#endif
/****************************************************************************************/
#include "pins2tool.h"
......
......@@ -40,4 +40,4 @@
//============================================================================
\ No newline at end of file
//============================================================================
......@@ -664,37 +664,37 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
#ifndef COREXY
if (target[X_AXIS] < position[X_AXIS])
{
block->direction_bits |= (1<<X_AXIS);
block->direction_bits |= BIT(X_AXIS);
}
if (target[Y_AXIS] < position[Y_AXIS])
{
block->direction_bits |= (1<<Y_AXIS);
block->direction_bits |= BIT(Y_AXIS);
}
#else //COREXY
if (target[X_AXIS] < position[X_AXIS])
{
block->direction_bits |= (1<<X_HEAD);
block->direction_bits |= BIT(X_HEAD);
}
if (target[Y_AXIS] < position[Y_AXIS])
{
block->direction_bits |= (1<<Y_HEAD);
block->direction_bits |= BIT(Y_HEAD);
}
if ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]) < 0)
{
block->direction_bits |= (1<<X_AXIS);
block->direction_bits |= BIT(X_AXIS);
}
if ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]) < 0)
{
block->direction_bits |= (1<<Y_AXIS);
block->direction_bits |= BIT(Y_AXIS);
}
#endif //COREXY
if (target[Z_AXIS] < position[Z_AXIS])
{
block->direction_bits |= (1<<Z_AXIS);
block->direction_bits |= BIT(Z_AXIS);
}
if (target[E_AXIS] < position[E_AXIS])
{
block->direction_bits |= (1<<E_AXIS);
block->direction_bits |= BIT(E_AXIS);
}
block->active_driver = driver;
......@@ -934,7 +934,7 @@ Having the real displacement of the head, we can calculate the total movement le
old_direction_bits = block->direction_bits;
segment_time = lround((float)segment_time / speed_factor);
if((direction_change & (1<<X_AXIS)) == 0)
if((direction_change & BIT(X_AXIS)) == 0)
{
x_segment_time[0] += segment_time;
}
......@@ -944,7 +944,7 @@ Having the real displacement of the head, we can calculate the total movement le
x_segment_time[1] = x_segment_time[0];
x_segment_time[0] = segment_time;
}
if((direction_change & (1<<Y_AXIS)) == 0)
if((direction_change & BIT(Y_AXIS)) == 0)
{
y_segment_time[0] += segment_time;
}
......@@ -1185,7 +1185,8 @@ void set_extrude_min_temp(float temp) { extrude_min_temp = temp; }
#endif
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates() {
void reset_acceleration_rates()
{
for(int8_t i=0; i < 3 + EXTRUDERS; i++) {
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
}
......
This diff is collapsed.
......@@ -25,32 +25,32 @@
#include "stepper_indirection.h"
#if DRIVER_EXTRUDERS > 3
#define WRITE_E_STEP(v) { if(current_block->active_driver == 3) { E3_STEP_WRITE(v); } else { if(current_block->active_driver == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}}
#define E_STEP_WRITE(v) { if(current_block->active_driver == 3) { E3_STEP_WRITE(v); } else { if(current_block->active_driver == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}}
#define NORM_E_DIR() { if(current_block->active_driver == 3) { E3_DIR_WRITE( !INVERT_E3_DIR); } else { if(current_block->active_driver == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}}
#define REV_E_DIR() { if(current_block->active_driver == 3) { E3_DIR_WRITE(INVERT_E3_DIR); } else { if(current_block->active_driver == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}}
#elif DRIVER_EXTRUDERS > 2
#define WRITE_E_STEP(v) { if(current_block->active_driver == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}
#define E_STEP_WRITE(v) { if(current_block->active_driver == 2) { E2_STEP_WRITE(v); } else { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}}
#define NORM_E_DIR() { if(current_block->active_driver == 2) { E2_DIR_WRITE(!INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}}
#define REV_E_DIR() { if(current_block->active_driver == 2) { E2_DIR_WRITE(INVERT_E2_DIR); } else { if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}}
#elif DRIVER_EXTRUDERS > 1
#ifndef DUAL_X_CARRIAGE
#define WRITE_E_STEP(v) { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define E_STEP_WRITE(v) { if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
#else
extern bool extruder_duplication_enabled;
#define WRITE_E_STEP(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define E_STEP_WRITE(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(INVERT_E0_DIR); E1_DIR_WRITE(INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(INVERT_E1_DIR); } else { E0_DIR_WRITE(INVERT_E0_DIR); }}
#endif
#else
#define WRITE_E_STEP(v) E0_STEP_WRITE(v)
#define E_STEP_WRITE(v) E0_STEP_WRITE(v)
#define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
#endif //DRIVER_EXTRUDERS
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
extern bool abort_on_endstop_hit;
extern bool abort_on_endstop_hit;
#endif
// Initialize and start the stepper motor subsystem
......@@ -67,8 +67,8 @@ void st_set_e_position(const long &e);
long st_get_position(uint8_t axis);
#ifdef ENABLE_AUTO_BED_LEVELING
// Get current position in mm
float st_get_position_mm(uint8_t axis);
// Get current position in mm
float st_get_position_mm(uint8_t axis);
#endif //ENABLE_AUTO_BED_LEVELING
// The stepper subsystem goes to sleep when it runs out of things to execute. Call this
......
......@@ -574,17 +574,17 @@ inline void _temp_error(int e, const char *msg1, const char *msg2) {
void max_temp_error(uint8_t e) {
disable_heater();
_temp_error(e, MSG_MAXTEMP_EXTRUDER_OFF, MSG_ERR_MAXTEMP);
_temp_error(e, PSTR(MSG_MAXTEMP_EXTRUDER_OFF), PSTR(MSG_ERR_MAXTEMP));
}
void min_temp_error(uint8_t e) {
disable_heater();
_temp_error(e, MSG_MINTEMP_EXTRUDER_OFF, MSG_ERR_MINTEMP);
_temp_error(e, PSTR(MSG_MINTEMP_EXTRUDER_OFF), PSTR(MSG_ERR_MINTEMP));
}
void bed_max_temp_error(void) {
#if HAS_HEATER_BED
WRITE_HEATER_BED(0);
#endif
_temp_error(-1, MSG_MAXTEMP_BED_OFF, MSG_ERR_MAXTEMP_BED);
_temp_error(-1, PSTR(MSG_MAXTEMP_BED_OFF), PSTR(MSG_ERR_MAXTEMP_BED));
}
void manage_heater() {
......@@ -939,8 +939,8 @@ void tp_init()
{
#if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
//disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR=(1<<JTD);
MCUCR=(1<<JTD);
MCUCR=BIT(JTD);
MCUCR=BIT(JTD);
#endif
// Finish init of mult extruder arrays
......@@ -1003,13 +1003,13 @@ void tp_init()
#endif //HEATER_0_USES_MAX6675
#ifdef DIDR2
#define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= 1 << pin; else DIDR2 |= 1 << (pin - 8); }while(0)
#define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0)
#else
#define ANALOG_SELECT(pin) do{ DIDR0 |= 1 << pin; }while(0)
#define ANALOG_SELECT(pin) do{ DIDR0 |= BIT(pin); }while(0)
#endif
// Set analog inputs
ADCSRA = 1<<ADEN | 1<<ADSC | 1<<ADIF | 0x07;
ADCSRA = BIT(ADEN) | BIT(ADSC) | BIT(ADIF) | 0x07;
DIDR0 = 0;
#ifdef DIDR2
DIDR2 = 0;
......@@ -1036,7 +1036,7 @@ void tp_init()
// Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt
OCR0B = 128;
TIMSK0 |= (1<<OCIE0B);
TIMSK0 |= BIT(OCIE0B);
// Wait for temperature measurement to settle
delay(250);
......@@ -1252,12 +1252,12 @@ void disable_heater() {
max6675_temp = 0;
#ifdef PRR
PRR &= ~(1<<PRSPI);
PRR &= ~BIT(PRSPI);
#elif defined(PRR0)
PRR0 &= ~(1<<PRSPI);
PRR0 &= ~BIT(PRSPI);
#endif
SPCR = (1<<MSTR) | (1<<SPE) | (1<<SPR0);
SPCR = BIT(MSTR) | BIT(SPE) | BIT(SPR0);
// enable TT_MAX6675
WRITE(MAX6675_SS, 0);
......@@ -1268,13 +1268,13 @@ void disable_heater() {
// read MSB
SPDR = 0;
for (;(SPSR & (1<<SPIF)) == 0;);
for (;(SPSR & BIT(SPIF)) == 0;);
max6675_temp = SPDR;
max6675_temp <<= 8;
// read LSB
SPDR = 0;
for (;(SPSR & (1<<SPIF)) == 0;);
for (;(SPSR & BIT(SPIF)) == 0;);
max6675_temp |= SPDR;
// disable TT_MAX6675
......@@ -1319,7 +1319,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned long raw_temp_3_value = 0;
static unsigned long raw_temp_bed_value = 0;
static TempState temp_state = StartupDelay;
static unsigned char pwm_count = (1 << SOFT_PWM_SCALE);
static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
// Static members for each heater
#ifdef SLOW_PWM_HEATERS
......@@ -1407,7 +1407,7 @@ ISR(TIMER0_COMPB_vect) {
if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#endif
pwm_count += (1 << SOFT_PWM_SCALE);
pwm_count += BIT(SOFT_PWM_SCALE);
pwm_count &= 0x7f;
#else // SLOW_PWM_HEATERS
......@@ -1492,7 +1492,7 @@ ISR(TIMER0_COMPB_vect) {
if (soft_pwm_fan < pwm_count) WRITE_FAN(0);
#endif //FAN_SOFT_PWM
pwm_count += (1 << SOFT_PWM_SCALE);
pwm_count += BIT(SOFT_PWM_SCALE);
pwm_count &= 0x7f;
// increment slow_pwm_count only every 64 pwm_count circa 65.5ms
......@@ -1520,9 +1520,9 @@ ISR(TIMER0_COMPB_vect) {
#endif // SLOW_PWM_HEATERS
#define SET_ADMUX_ADCSRA(pin) ADMUX = (1 << REFS0) | (pin & 0x07); ADCSRA |= 1<<ADSC
#define SET_ADMUX_ADCSRA(pin) ADMUX = BIT(REFS0) | (pin & 0x07); ADCSRA |= BIT(ADSC)
#ifdef MUX5
#define START_ADC(pin) if (pin > 7) ADCSRB = 1 << MUX5; else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#define START_ADC(pin) if (pin > 7) ADCSRB = BIT(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#else
#define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
#endif
......
......@@ -146,7 +146,7 @@ FORCE_INLINE bool isCoolingHotend(uint8_t extruder) {
#else
return target_temperature[0] < current_temperature[0];
#endif
};
}
FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
......
......@@ -13,6 +13,11 @@ int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added t
bool encoderRateMultiplierEnabled;
int32_t lastEncoderMovementMillis;
int pageShowInfo = 0;
boolean ChangeScreen = false;
void set_pageShowInfo(int value){ pageShowInfo = value; }
void set_ChangeScreen(boolean state) { ChangeScreen = state; }
/* Configuration settings */
int plaPreheatHotendTemp;
int plaPreheatHPBTemp;
......@@ -651,6 +656,99 @@ void lcd_cooldown() {
lcd_return_to_status();
}
void config_lcd_level_bed()
{
setTargetHotend(0,0);
SERIAL_ECHOLN("Leveling...");
currentMenu = lcd_level_bed;
enquecommands_P(PSTR("G28 M"));
pageShowInfo = 0;
}
void lcd_level_bed()
{
if(ChangeScreen){
lcd.clear();
switch(pageShowInfo){
case 0:
{
lcd.setCursor(0, 1);
lcd_printPGM(PSTR(MSG_LP_INTRO));
currentMenu = lcd_level_bed;
ChangeScreen=false;
}
break;
case 1:
{
lcd.setCursor(0, 1);
lcd_printPGM(PSTR(MSG_LP_1));
currentMenu = lcd_level_bed;
ChangeScreen=false;
}
break;
case 2:
{
lcd.setCursor(0, 1);
lcd_printPGM(PSTR(MSG_LP_2));
currentMenu = lcd_level_bed;
ChangeScreen=false;
}
break;
case 3:
{
lcd.setCursor(0, 1);
lcd_printPGM(PSTR(MSG_LP_3));
currentMenu = lcd_level_bed;
ChangeScreen=false;
}
break;
case 4:
{
lcd.setCursor(0, 1);
lcd_printPGM(PSTR(MSG_LP_4));
currentMenu = lcd_level_bed;
ChangeScreen=false;
}
break;
case 5:
{
lcd.setCursor(0, 1);
lcd_printPGM(PSTR(MSG_LP_5));
currentMenu = lcd_level_bed;
ChangeScreen=false;
}
break;
case 6:
{
lcd.setCursor(2, 2);
lcd_printPGM(PSTR(MSG_LP_6));
ChangeScreen=false;
delay(1200);
encoderPosition = 0;
lcd.clear();
currentMenu = lcd_status_screen;
lcd_status_screen();
pageShowInfo=0;
}
break;
}
}
}
static void lcd_prepare_menu() {
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
......@@ -662,7 +760,7 @@ static void lcd_prepare_menu() {
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
#ifndef DELTA
MENU_ITEM(gcode, MSG_BED_SETTING, PSTR("G28 M"));
MENU_ITEM(function, MSG_BED_SETTING, config_lcd_level_bed);
#endif
MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets);
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
......@@ -1531,7 +1629,7 @@ void lcd_buttons_update() {
WRITE(SHIFT_LD, HIGH);
for(int8_t i = 0; i < 8; i++) {
newbutton_reprapworld_keypad >>= 1;
if (READ(SHIFT_OUT)) newbutton_reprapworld_keypad |= (1 << 7);
if (READ(SHIFT_OUT)) newbutton_reprapworld_keypad |= BIT(7);
WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW);
}
......@@ -1544,7 +1642,7 @@ void lcd_buttons_update() {
unsigned char tmp_buttons = 0;
for(int8_t i=0; i<8; i++) {
newbutton >>= 1;
if (READ(SHIFT_OUT)) newbutton |= (1 << 7);
if (READ(SHIFT_OUT)) newbutton |= BIT(7);
WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW);
}
......
......@@ -19,6 +19,11 @@
void lcd_setcontrast(uint8_t value);
#endif
void set_pageShowInfo(int value);
void set_ChangeScreen(boolean state);
void config_lcd_level_bed(void);
void lcd_level_bed(void);
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
......
......@@ -24,13 +24,13 @@
#define BLEN_B 1
#define BLEN_A 0
#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A (1<<BLEN_A)
#define EN_B BIT(BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A BIT(BLEN_A)
#if defined(BTN_ENC) && BTN_ENC > -1
// encoder click is directly connected
#define BLEN_C 2
#define EN_C (1<<BLEN_C)
#define EN_C BIT(BLEN_C)
#endif
//
......@@ -85,14 +85,14 @@
#define REPRAPWORLD_BTN_OFFSET 3 // bit offset into buttons for shift register values
#define EN_REPRAPWORLD_KEYPAD_F3 (1<<(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F2 (1<<(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F1 (1<<(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_UP (1<<(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_DOWN (1<<(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_LEFT (1<<(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F3 BIT((BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F2 BIT((BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F1 BIT((BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_UP BIT((BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_RIGHT BIT((BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE BIT((BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_DOWN BIT((BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_LEFT BIT((BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
#define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
......@@ -113,12 +113,12 @@
#define BL_ST 2
//automatic, do not change
#define B_LE (1<<BL_LE)
#define B_UP (1<<BL_UP)
#define B_MI (1<<BL_MI)
#define B_DW (1<<BL_DW)
#define B_RI (1<<BL_RI)
#define B_ST (1<<BL_ST)
#define B_LE BIT(BL_LE)
#define B_UP BIT(BL_UP)
#define B_MI BIT(BL_MI)
#define B_DW BIT(BL_DW)
#define B_RI BIT(BL_RI)
#define B_ST BIT(BL_ST)
#define LCD_CLICKED (buttons&(B_MI|B_ST))
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment