Clean up "else" and other spacing
This commit is contained in:
parent
9b23490f01
commit
9bdab4f3a8
12 changed files with 115 additions and 68 deletions
|
@ -78,7 +78,8 @@ void MarlinSerial::begin(long baud) {
|
|||
if (useU2X) {
|
||||
M_UCSRxA = BIT(M_U2Xx);
|
||||
baud_setting = (F_CPU / 4 / baud - 1) / 2;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
M_UCSRxA = 0;
|
||||
baud_setting = (F_CPU / 8 / baud - 1) / 2;
|
||||
}
|
||||
|
|
|
@ -1688,7 +1688,8 @@ static void setup_for_endstop_move() {
|
|||
if (a < b) {
|
||||
if (b < c) median = b;
|
||||
if (c < a) median = a;
|
||||
} else { // b <= a
|
||||
}
|
||||
else { // b <= a
|
||||
if (c < b) median = b;
|
||||
if (a < c) median = a;
|
||||
}
|
||||
|
@ -1783,7 +1784,8 @@ static void setup_for_endstop_move() {
|
|||
#endif
|
||||
do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1); // Dock sled a bit closer to ensure proper capturing
|
||||
digitalWrite(SLED_PIN, LOW); // turn off magnet
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
float z_loc = current_position[Z_AXIS];
|
||||
if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING;
|
||||
do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], z_loc); // this also updates current_position
|
||||
|
@ -2696,7 +2698,8 @@ inline void gcode_G28() {
|
|||
SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
SERIAL_PROTOCOLPGM("X not entered.\n");
|
||||
return;
|
||||
}
|
||||
|
@ -2706,7 +2709,8 @@ inline void gcode_G28() {
|
|||
SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
SERIAL_PROTOCOLPGM("Y not entered.\n");
|
||||
return;
|
||||
}
|
||||
|
@ -6381,25 +6385,29 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|||
ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
|
||||
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
||||
x_splits ^= BIT(ix);
|
||||
} else if (ix < pix && (x_splits) & BIT(pix)) {
|
||||
}
|
||||
else if (ix < pix && (x_splits) & BIT(pix)) {
|
||||
nx = mbl.get_x(pix);
|
||||
normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
|
||||
ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
|
||||
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
||||
x_splits ^= BIT(pix);
|
||||
} else if (iy > piy && (y_splits) & BIT(iy)) {
|
||||
}
|
||||
else if (iy > piy && (y_splits) & BIT(iy)) {
|
||||
ny = mbl.get_y(iy);
|
||||
normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
|
||||
nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
|
||||
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
||||
y_splits ^= BIT(iy);
|
||||
} else if (iy < piy && (y_splits) & BIT(piy)) {
|
||||
}
|
||||
else if (iy < piy && (y_splits) & BIT(piy)) {
|
||||
ny = mbl.get_y(piy);
|
||||
normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
|
||||
nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
|
||||
ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
||||
y_splits ^= BIT(piy);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Already split on a border
|
||||
plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
||||
set_current_to_destination();
|
||||
|
|
|
@ -192,11 +192,13 @@ uint32_t Sd2Card::cardSize() {
|
|||
uint8_t c_size_mult = (csd.v1.c_size_mult_high << 1)
|
||||
| csd.v1.c_size_mult_low;
|
||||
return (uint32_t)(c_size + 1) << (c_size_mult + read_bl_len - 7);
|
||||
} else if (csd.v2.csd_ver == 1) {
|
||||
}
|
||||
else if (csd.v2.csd_ver == 1) {
|
||||
uint32_t c_size = ((uint32_t)csd.v2.c_size_high << 16)
|
||||
| (csd.v2.c_size_mid << 8) | csd.v2.c_size_low;
|
||||
return (c_size + 1) << 10;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
error(SD_CARD_ERROR_BAD_CSD);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -396,7 +396,8 @@ static inline __attribute__((always_inline))
|
|||
bool getPinMode(uint8_t pin) {
|
||||
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
|
||||
return (*digitalPinMap[pin].ddr >> digitalPinMap[pin].bit) & 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return badPinNumber();
|
||||
}
|
||||
}
|
||||
|
@ -405,10 +406,12 @@ static inline __attribute__((always_inline))
|
|||
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
|
||||
if (mode) {
|
||||
*digitalPinMap[pin].ddr |= BIT(digitalPinMap[pin].bit);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*digitalPinMap[pin].ddr &= ~BIT(digitalPinMap[pin].bit);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
badPinNumber();
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +419,8 @@ static inline __attribute__((always_inline))
|
|||
bool fastDigitalRead(uint8_t pin) {
|
||||
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
|
||||
return (*digitalPinMap[pin].pin >> digitalPinMap[pin].bit) & 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return badPinNumber();
|
||||
}
|
||||
}
|
||||
|
@ -425,10 +429,12 @@ static inline __attribute__((always_inline))
|
|||
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
|
||||
if (value) {
|
||||
*digitalPinMap[pin].port |= BIT(digitalPinMap[pin].bit);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*digitalPinMap[pin].port &= ~BIT(digitalPinMap[pin].bit);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
badPinNumber();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,9 +206,11 @@ static void lcd_implementation_init() {
|
|||
pinMode(LCD_PIN_RESET, OUTPUT);
|
||||
digitalWrite(LCD_PIN_RESET, HIGH);
|
||||
#endif
|
||||
|
||||
#if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
|
||||
u8g.setContrast(lcd_contrast);
|
||||
#endif
|
||||
|
||||
// FIXME: remove this workaround
|
||||
// Uncomment this if you have the first generation (V1.10) of STBs board
|
||||
// pinMode(17, OUTPUT); // Enable LCD backlight
|
||||
|
|
|
@ -30,15 +30,15 @@
|
|||
|
||||
#define _WRITE_C(IO, v) do { if (v) { \
|
||||
CRITICAL_SECTION_START; \
|
||||
{DIO ## IO ## _WPORT |= MASK(DIO ## IO ## _PIN); }\
|
||||
{DIO ## IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } \
|
||||
CRITICAL_SECTION_END; \
|
||||
}\
|
||||
else {\
|
||||
} \
|
||||
else { \
|
||||
CRITICAL_SECTION_START; \
|
||||
{DIO ## IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }\
|
||||
{DIO ## IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); } \
|
||||
CRITICAL_SECTION_END; \
|
||||
}\
|
||||
}\
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define _WRITE(IO, v) do { if (&(DIO ## IO ## _RPORT) >= (uint8_t *)0x100) {_WRITE_C(IO, v); } else {_WRITE_NC(IO, v); }; } while (0)
|
||||
|
|
|
@ -439,10 +439,12 @@ void check_axes_activity() {
|
|||
// Just starting up fan - run at full power.
|
||||
fan_kick_end = ms + FAN_KICKSTART_TIME;
|
||||
tail_fan_speed = 255;
|
||||
} else if (fan_kick_end > ms)
|
||||
}
|
||||
else if (fan_kick_end > ms)
|
||||
// Fan still spinning up.
|
||||
tail_fan_speed = 255;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fan_kick_end = 0;
|
||||
}
|
||||
#endif //FAN_KICKSTART_TIME
|
||||
|
|
|
@ -494,7 +494,8 @@ double dnrm2(int n, double x[], int incx)
|
|||
if (scale < absxi) {
|
||||
ssq = 1.0 + ssq * (scale / absxi) * (scale / absxi);
|
||||
scale = absxi;
|
||||
} else
|
||||
}
|
||||
else
|
||||
ssq = ssq + (absxi / scale) * (absxi / scale);
|
||||
}
|
||||
ix += incx;
|
||||
|
@ -1404,7 +1405,8 @@ void dscal(int n, double sa, double x[], int incx)
|
|||
x[i + 3] = sa * x[i + 3];
|
||||
x[i + 4] = sa * x[i + 4];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (0 <= incx)
|
||||
ix = 0;
|
||||
else
|
||||
|
@ -1486,7 +1488,6 @@ void dswap(int n, double x[], int incx, double y[], int incy)
|
|||
x[i + 2] = y[i + 2];
|
||||
y[i + 2] = temp;
|
||||
}
|
||||
} else {
|
||||
if (0 <= incx)
|
||||
ix = 0;
|
||||
else
|
||||
|
@ -1495,6 +1496,8 @@ void dswap(int n, double x[], int incx, double y[], int incy)
|
|||
iy = 0;
|
||||
else
|
||||
iy = (- n + 1) * incy;
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < n; i++) {
|
||||
temp = x[ix];
|
||||
x[ix] = y[iy];
|
||||
|
|
|
@ -139,11 +139,13 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
|
|||
if (Z_HOME_DIR > 0) {\
|
||||
if (!(TEST(old_endstop_bits, Z_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
|
||||
if (!(TEST(old_endstop_bits, Z2_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
|
||||
} else {\
|
||||
} \
|
||||
else { \
|
||||
if (!(TEST(old_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
|
||||
if (!(TEST(old_endstop_bits, Z2_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
|
||||
} \
|
||||
} else { \
|
||||
} \
|
||||
else { \
|
||||
Z_STEP_WRITE(v); \
|
||||
Z2_STEP_WRITE(v); \
|
||||
}
|
||||
|
|
|
@ -511,7 +511,8 @@ float get_pid_output(int e) {
|
|||
if (e_position > last_position[e]) {
|
||||
lpq[lpq_ptr++] = e_position - last_position[e];
|
||||
last_position[e] = e_position;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lpq[lpq_ptr++] = 0;
|
||||
}
|
||||
if (lpq_ptr >= lpq_len) lpq_ptr = 0;
|
||||
|
|
|
@ -716,8 +716,8 @@ static void lcd_implementation_status_screen() {
|
|||
lcd.print(ftostr12ns(filament_width_meas));
|
||||
lcd_printPGM(PSTR(" V"));
|
||||
lcd.print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
|
||||
lcd.print('%');
|
||||
return;
|
||||
lcd.print('%');
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // FILAMENT_LCD_DISPLAY
|
||||
|
|
|
@ -123,10 +123,12 @@
|
|||
#endif // SIMULATE_ROMFONT
|
||||
|
||||
#if ENABLED(MAPPER_NON)
|
||||
char charset_mapper(char c){
|
||||
|
||||
char charset_mapper(char c) {
|
||||
HARDWARE_CHAR_OUT( c );
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif ENABLED(MAPPER_C2C3)
|
||||
uint8_t utf_hi_char; // UTF-8 high part
|
||||
bool seen_c2 = false;
|
||||
|
@ -138,16 +140,16 @@
|
|||
seen_c2 = true;
|
||||
return 0;
|
||||
}
|
||||
else if (seen_c2){
|
||||
else if (seen_c2) {
|
||||
d &= 0x3f;
|
||||
#ifndef MAPPER_ONE_TO_ONE
|
||||
HARDWARE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20 ) );
|
||||
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
|
||||
#else
|
||||
HARDWARE_CHAR_OUT( (char) (0x80 + ( utf_hi_char << 6 ) + d) ) ;
|
||||
HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT('?');
|
||||
HARDWARE_CHAR_OUT('?');
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -156,96 +158,114 @@
|
|||
seen_c2 = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif ENABLED(MAPPER_D0D1_MOD)
|
||||
uint8_t utf_hi_char; // UTF-8 high part
|
||||
bool seen_d5 = false;
|
||||
char charset_mapper(char c){
|
||||
|
||||
char charset_mapper(char c) {
|
||||
// it is a Russian alphabet translation
|
||||
// except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
|
||||
uint8_t d = c;
|
||||
if ( d >= 0x80 ) { // UTF-8 handling
|
||||
if ((d >= 0xd0) && (!seen_d5)) {
|
||||
if (d >= 0x80) { // UTF-8 handling
|
||||
if (d >= 0xd0 && !seen_d5) {
|
||||
utf_hi_char = d - 0xd0;
|
||||
seen_d5 = true;
|
||||
return 0;
|
||||
} else if (seen_d5) {
|
||||
d &= 0x3f;
|
||||
if ( !utf_hi_char && ( d == 1 )) {
|
||||
HARDWARE_CHAR_OUT((char) 0xa2 ); // Ё
|
||||
} else if ((utf_hi_char == 1) && (d == 0x11)) {
|
||||
HARDWARE_CHAR_OUT((char) 0xb5 ); // ё
|
||||
} else {
|
||||
HARDWARE_CHAR_OUT((char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x10 ) );
|
||||
}
|
||||
}
|
||||
else if (seen_d5) {
|
||||
d &= 0x3f;
|
||||
if (!utf_hi_char && d == 1) {
|
||||
HARDWARE_CHAR_OUT((char) 0xa2); // Ё
|
||||
}
|
||||
else if (utf_hi_char == 1 && d == 0x11) {
|
||||
HARDWARE_CHAR_OUT((char)0xb5); // ё
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT('?');
|
||||
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x10));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT('?');
|
||||
}
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT((char) c );
|
||||
}
|
||||
seen_d5 = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif ENABLED(MAPPER_D0D1)
|
||||
uint8_t utf_hi_char; // UTF-8 high part
|
||||
bool seen_d5 = false;
|
||||
char charset_mapper(char c) {
|
||||
uint8_t d = c;
|
||||
if ( d >= 0x80u ) { // UTF-8 handling
|
||||
if ((d >= 0xd0u) && (!seen_d5)) {
|
||||
if (d >= 0x80u) { // UTF-8 handling
|
||||
if (d >= 0xd0u && !seen_d5) {
|
||||
utf_hi_char = d - 0xd0u;
|
||||
seen_d5 = true;
|
||||
return 0;
|
||||
} else if (seen_d5) {
|
||||
d &= 0x3fu;
|
||||
}
|
||||
else if (seen_d5) {
|
||||
d &= 0x3fu;
|
||||
#ifndef MAPPER_ONE_TO_ONE
|
||||
HARDWARE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20 ) );
|
||||
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
|
||||
#else
|
||||
HARDWARE_CHAR_OUT( (char) (0xa0u + ( utf_hi_char << 6 ) + d ) ) ;
|
||||
HARDWARE_CHAR_OUT((char)(0xa0u + (utf_hi_char << 6) + d)) ;
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT('?');
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT((char) c );
|
||||
}
|
||||
seen_d5 = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif ENABLED(MAPPER_E382E383)
|
||||
uint8_t utf_hi_char; // UTF-8 high part
|
||||
bool seen_e3 = false;
|
||||
bool seen_82_83 = false;
|
||||
char charset_mapper(char c){
|
||||
uint8_t d = c;
|
||||
if ( d >= 0x80 ) { // UTF-8 handling
|
||||
if ( (d == 0xe3) && (seen_e3 == false)) {
|
||||
if (d >= 0x80) { // UTF-8 handling
|
||||
if (d == 0xe3 && !seen_e3) {
|
||||
seen_e3 = true;
|
||||
return 0; // eat 0xe3
|
||||
} else if ( (d >= 0x82) && (seen_e3 == true) && (seen_82_83 == false)) {
|
||||
}
|
||||
else if (d >= 0x82 && seen_e3 && !seen_82_83) {
|
||||
utf_hi_char = d - 0x82;
|
||||
seen_82_83 = true;
|
||||
return 0;
|
||||
} else if ((seen_e3 == true) && (seen_82_83 == true)){
|
||||
}
|
||||
else if (seen_e3 && seen_82_83) {
|
||||
d &= 0x3f;
|
||||
#ifndef MAPPER_ONE_TO_ONE
|
||||
HARDWARE_CHAR_OUT( (char) pgm_read_byte_near( utf_recode + d + ( utf_hi_char << 6 ) - 0x20 ) );
|
||||
HARDWARE_CHAR_OUT((char)pgm_read_byte_near(utf_recode + d + (utf_hi_char << 6) - 0x20));
|
||||
#else
|
||||
HARDWARE_CHAR_OUT( (char) (0x80 + ( utf_hi_char << 6 ) + d ) ) ;
|
||||
HARDWARE_CHAR_OUT((char)(0x80 + (utf_hi_char << 6) + d)) ;
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT((char) '?' );
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HARDWARE_CHAR_OUT((char) c );
|
||||
}
|
||||
seen_e3 = false;
|
||||
seen_82_83 = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error "You have to define one of the DISPLAY_INPUT_CODE_MAPPERs in your language_xx.h file" // should not occur because (en) will set.
|
||||
|
||||
#endif // code mappers
|
||||
|
||||
#endif // UTF_MAPPER_H
|
||||
|
|
Loading…
Reference in a new issue