From f65833931d3a5af5fbb44e05dd808c10c41dbb06 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 13 May 2015 02:02:19 -0700 Subject: [PATCH] Formatting tweaks --- Marlin/Configuration.h | 3 +- Marlin/Marlin_main.cpp | 2 +- Marlin/cardreader.cpp | 1 + Marlin/temperature.cpp | 11 +- .../ultralcd_implementation_hitachi_HD44780.h | 107 ++++++++---------- 5 files changed, 58 insertions(+), 66 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 823fadc149..f71699db73 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -605,10 +605,9 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic #ifdef EEPROM_SETTINGS // To disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out: - #define EEPROM_CHITCHAT // please keep turned on if you can. + #define EEPROM_CHITCHAT // Please keep turned on if you can. #endif - // @section temperature // Preheat Constants diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index d4e1bf44ce..ecdad9977f 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5982,7 +5982,7 @@ void calculate_SCARA_forward_Transform(float f_scara[3]) delta[X_AXIS] = x_cos + y_cos + SCARA_offset_x; //theta delta[Y_AXIS] = x_sin + y_sin + SCARA_offset_y; //theta+phi - + //SERIAL_ECHOPGM(" delta[X_AXIS]="); SERIAL_ECHO(delta[X_AXIS]); //SERIAL_ECHOPGM(" delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]); } diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 639b4f244a..4b60172183 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -20,6 +20,7 @@ CardReader::CardReader() { autostart_stilltocheck = true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software. autostart_index = 0; + //power to SD reader #if SDPOWER > -1 OUT_WRITE(SDPOWER, HIGH); diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index ff730507ad..9ccd1de14d 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -245,8 +245,8 @@ void PID_autotune(float temp, int extruder, int ncycles) } #endif - if (heating == true && input > temp) { - if (ms - t2 > 5000) { + if (heating && input > temp) { + if (ms > t2 + 5000) { heating = false; if (extruder < 0) soft_pwm_bed = (bias - d) >> 1; @@ -257,8 +257,9 @@ void PID_autotune(float temp, int extruder, int ncycles) max = temp; } } - if (heating == false && input < temp) { - if (ms - t1 > 5000) { + + if (!heating && input < temp) { + if (ms > t1 + 5000) { heating = true; t2 = ms; t_low = t2 - t1; @@ -787,7 +788,7 @@ static void updateTemperaturesFromRawValues() { #ifdef HEATER_0_USES_MAX6675 current_temperature_raw[0] = read_max6675(); #endif - for(uint8_t e = 0; e < EXTRUDERS; e++) { + for (uint8_t e = 0; e < EXTRUDERS; e++) { current_temperature[e] = analog2temp(current_temperature_raw[e], e); } current_temperature_bed = analog2tempBed(current_temperature_bed_raw); diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 7f9a88e5b1..3f87e8b2f2 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -15,8 +15,8 @@ //////////////////////////////////// // Setup button and encode mappings for each panel (into 'buttons' variable // -// This is just to map common functions (across different panels) onto the same -// macro name. The mapping is independent of whether the button is directly connected or +// This is just to map common functions (across different panels) onto the same +// macro name. The mapping is independent of whether the button is directly connected or // via a shift/i2c register. #ifdef ULTIPANEL @@ -38,7 +38,7 @@ // #if defined(LCD_I2C_VIKI) #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) - + // button and encoder bit positions within 'buttons' #define B_LE (BUTTON_LEFT< -1 + #if defined(BTN_ENC) && BTN_ENC > -1 // the pause/stop/restart button is connected to BTN_ENC when used - #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name + #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop. #else #define LCD_CLICKED (buttons&(B_MI|B_RI)) - #endif + #endif // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update #define LCD_HAS_SLOW_BUTTONS #elif defined(LCD_I2C_PANELOLU2) // encoder click can be read through I2C if not directly connected - #if BTN_ENC <= 0 + #if BTN_ENC <= 0 #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) - + #define B_MI (PANELOLU2_ENCODER_C< #define LCD_CLASS LiquidCrystal_I2C LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7); - + #elif defined(LCD_I2C_TYPE_MCP23017) //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators()) #define LED_A 0x04 //100 @@ -156,28 +156,28 @@ #include #define LCD_CLASS LiquidTWI2 #if defined(DETECT_DEVICE) - LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); + LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); #else - LCD_CLASS lcd(LCD_I2C_ADDRESS); + LCD_CLASS lcd(LCD_I2C_ADDRESS); #endif - + #elif defined(LCD_I2C_TYPE_MCP23008) #include #include #define LCD_CLASS LiquidTWI2 #if defined(DETECT_DEVICE) - LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); + LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); #else - LCD_CLASS lcd(LCD_I2C_ADDRESS); + LCD_CLASS lcd(LCD_I2C_ADDRESS); #endif #elif defined(LCD_I2C_TYPE_PCA8574) #include #define LCD_CLASS LiquidCrystal_I2C LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); - + // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection #elif defined(SR_LCD_2W_NL) extern "C" void __cxa_pure_virtual() { while (1); } #include @@ -353,65 +353,56 @@ static void lcd_implementation_init( #endif ) { -#if defined(LCD_I2C_TYPE_PCF8575) + #if defined(LCD_I2C_TYPE_PCF8575) lcd.begin(LCD_WIDTH, LCD_HEIGHT); - #ifdef LCD_I2C_PIN_BL - lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE); - lcd.setBacklight(HIGH); - #endif - -#elif defined(LCD_I2C_TYPE_MCP23017) + #ifdef LCD_I2C_PIN_BL + lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE); + lcd.setBacklight(HIGH); + #endif + + #elif defined(LCD_I2C_TYPE_MCP23017) lcd.setMCPType(LTI_TYPE_MCP23017); lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.setBacklight(0); //set all the LEDs off to begin with - -#elif defined(LCD_I2C_TYPE_MCP23008) + + #elif defined(LCD_I2C_TYPE_MCP23008) lcd.setMCPType(LTI_TYPE_MCP23008); lcd.begin(LCD_WIDTH, LCD_HEIGHT); -#elif defined(LCD_I2C_TYPE_PCA8574) - lcd.init(); - lcd.backlight(); - -#else + #elif defined(LCD_I2C_TYPE_PCA8574) + lcd.init(); + lcd.backlight(); + + #else lcd.begin(LCD_WIDTH, LCD_HEIGHT); -#endif + #endif - lcd_set_custom_characters( - #ifdef LCD_PROGRESS_BAR - progress_bar_set - #endif - ); + lcd_set_custom_characters( + #ifdef LCD_PROGRESS_BAR + progress_bar_set + #endif + ); - lcd.clear(); -} -static void lcd_implementation_clear() -{ - lcd.clear(); + lcd.clear(); } +static void lcd_implementation_clear() { lcd.clear(); } + /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ char lcd_printPGM(const char* str) { - char c; - char n = 0; - while((c = pgm_read_byte(str++))) { - n += charset_mapper(c); - } + char c, n = 0; + while ((c = pgm_read_byte(str++))) n += charset_mapper(c); return n; } char lcd_print(char* str) { char c, n = 0;; unsigned char i = 0; - while((c = str[i++])) { - n += charset_mapper(c); - } + while ((c = str[i++])) n += charset_mapper(c); return n; } -unsigned lcd_print(char c) { - return charset_mapper(c); -} +unsigned lcd_print(char c) { return charset_mapper(c); } /* Possible status screens: @@ -437,7 +428,7 @@ Possible status screens: 20x4 |01234567890123456789| |T000/000D B000/000D | - |T000/000D Z000.0| + |T000/000D Z000.00 | |F100% SD100% T--:--| |Status line.........| */ @@ -728,13 +719,13 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const static void lcd_implementation_update_indicators() { #if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI) - //set the LEDS - referred to as backlights by the LiquidTWI2 library + // Set the LEDS - referred to as backlights by the LiquidTWI2 library static uint8_t ledsprev = 0; uint8_t leds = 0; if (target_temperature_bed > 0) leds |= LED_A; if (target_temperature[0] > 0) leds |= LED_B; if (fanSpeed) leds |= LED_C; - #if EXTRUDERS > 1 + #if EXTRUDERS > 1 if (target_temperature[1] > 0) leds |= LED_C; #endif if (leds != ledsprev) { @@ -766,4 +757,4 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const #endif // LCD_HAS_SLOW_BUTTONS -#endif //__ULTRALCD_IMPLEMENTATION_HITACHI_HD44780_H +#endif // ULTRALCD_IMPLEMENTATION_HITACHI_HD44780_H