Scott Lahteine 2 лет назад
Родитель
Сommit
7e5d5330d6

+ 2
- 2
Marlin/src/HAL/STM32/tft/tft_ltdc.cpp Просмотреть файл

372
     if (MemoryIncrease == DMA_PINC_ENABLE) {
372
     if (MemoryIncrease == DMA_PINC_ENABLE) {
373
       DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
373
       DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
374
       Data += width * height;
374
       Data += width * height;
375
-    } else {
376
-      DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
377
     }
375
     }
376
+    else
377
+      DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
378
     y_cur += height;
378
     y_cur += height;
379
   }
379
   }
380
 
380
 

+ 10
- 9
Marlin/src/feature/direct_stepping.cpp Просмотреть файл

143
           // special case for 8-bit, check if rolled back to 0
143
           // special case for 8-bit, check if rolled back to 0
144
           if (Cfg::DIRECTIONAL || !write_page_size) { // full 256 bytes
144
           if (Cfg::DIRECTIONAL || !write_page_size) { // full 256 bytes
145
             if (write_byte_idx) return true;
145
             if (write_byte_idx) return true;
146
-          } else {
147
-            if (write_byte_idx < write_page_size) return true;
148
           }
146
           }
149
-        } else if (Cfg::DIRECTIONAL) {
150
-          if (write_byte_idx != Cfg::PAGE_SIZE) return true;
151
-        } else {
152
-          if (write_byte_idx < write_page_size) return true;
147
+          else if (write_byte_idx < write_page_size)
148
+            return true;
149
+        }
150
+        else if (Cfg::DIRECTIONAL) {
151
+          if (write_byte_idx != Cfg::PAGE_SIZE)
152
+            return true;
153
         }
153
         }
154
+        else if (write_byte_idx < write_page_size)
155
+          return true;
154
 
156
 
155
         state = State::CHECKSUM;
157
         state = State::CHECKSUM;
156
         return true;
158
         return true;
161
         return true;
163
         return true;
162
       }
164
       }
163
       case State::UNFAIL:
165
       case State::UNFAIL:
164
-        if (c == 0) {
166
+        if (c == 0)
165
           set_page_state(write_page_idx, PageState::FREE);
167
           set_page_state(write_page_idx, PageState::FREE);
166
-        } else {
168
+        else
167
           fatal_error = true;
169
           fatal_error = true;
168
-        }
169
         state = State::MONITOR;
170
         state = State::MONITOR;
170
         return true;
171
         return true;
171
     }
172
     }

+ 2
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp Просмотреть файл

171
 
171
 
172
     const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10;
172
     const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10;
173
 
173
 
174
-    if (mydata.t_tag && !t_ok) {
174
+    if (mydata.t_tag && !t_ok)
175
       cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
175
       cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
176
-    } else if (getActualTemp_celsius(e) > 100) {
176
+    else if (getActualTemp_celsius(e) > 100) {
177
       cmd.cmd(COLOR_RGB(0xFF0000))
177
       cmd.cmd(COLOR_RGB(0xFF0000))
178
          .text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION))
178
          .text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION))
179
          .colors(normal_btn)
179
          .colors(normal_btn)

+ 6
- 5
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp Просмотреть файл

111
   cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
111
   cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
112
   cmd.font(font_medium).rectangle(bx, by, bw, bh);
112
   cmd.font(font_medium).rectangle(bx, by, bw, bh);
113
   cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
113
   cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
114
-  #if ENABLED(SCROLL_LONG_FILENAMES)
115
-    if (is_highlighted) {
114
+  if (TERN0(SCROLL_LONG_FILENAMES, is_highlighted)) {
115
+    #if ENABLED(SCROLL_LONG_FILENAMES)
116
       cmd.cmd(SAVE_CONTEXT());
116
       cmd.cmd(SAVE_CONTEXT());
117
       cmd.cmd(SCISSOR_XY(x,y));
117
       cmd.cmd(SCISSOR_XY(x,y));
118
       cmd.cmd(SCISSOR_SIZE(w,h));
118
       cmd.cmd(SCISSOR_SIZE(w,h));
119
       cmd.cmd(MACRO(0));
119
       cmd.cmd(MACRO(0));
120
       cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
120
       cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
121
-    } else
122
-  #endif
123
-  draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
121
+    #endif
122
+  }
123
+  else
124
+    draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
124
   if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "),  OPT_CENTERY | OPT_RIGHTX);
125
   if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "),  OPT_CENTERY | OPT_RIGHTX);
125
   #if ENABLED(SCROLL_LONG_FILENAMES)
126
   #if ENABLED(SCROLL_LONG_FILENAMES)
126
     if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());
127
     if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());

+ 28
- 25
Marlin/src/lcd/extui/mks_ui/wifiSerial_STM32.cpp Просмотреть файл

53
 WifiSerial::WifiSerial(void *peripheral) {
53
 WifiSerial::WifiSerial(void *peripheral) {
54
   // If PIN_SERIALy_RX is not defined assume half-duplex
54
   // If PIN_SERIALy_RX is not defined assume half-duplex
55
   _serial.pin_rx = NC;
55
   _serial.pin_rx = NC;
56
+  if (false) {
57
+    // for else if / else below...
58
+  }
56
   // If Serial is defined in variant set
59
   // If Serial is defined in variant set
57
   // the Rx/Tx pins for com port if defined
60
   // the Rx/Tx pins for com port if defined
58
   #if defined(Serial) && defined(PIN_SERIAL_TX)
61
   #if defined(Serial) && defined(PIN_SERIAL_TX)
59
-    if ((void *)this == (void *)&Serial) {
62
+    else if ((void *)this == (void *)&Serial) {
60
       #ifdef PIN_SERIAL_RX
63
       #ifdef PIN_SERIAL_RX
61
         setRx(PIN_SERIAL_RX);
64
         setRx(PIN_SERIAL_RX);
62
       #endif
65
       #endif
63
       setTx(PIN_SERIAL_TX);
66
       setTx(PIN_SERIAL_TX);
64
-    } else
67
+    }
65
   #endif
68
   #endif
66
   #if defined(PIN_SERIAL1_TX) && defined(USART1_BASE)
69
   #if defined(PIN_SERIAL1_TX) && defined(USART1_BASE)
67
-    if (peripheral == USART1) {
70
+    else if (peripheral == USART1) {
68
       #ifdef PIN_SERIAL1_RX
71
       #ifdef PIN_SERIAL1_RX
69
         setRx(PIN_SERIAL1_RX);
72
         setRx(PIN_SERIAL1_RX);
70
       #endif
73
       #endif
71
       setTx(PIN_SERIAL1_TX);
74
       setTx(PIN_SERIAL1_TX);
72
-    } else
75
+    }
73
   #endif
76
   #endif
74
   #if defined(PIN_SERIAL2_TX) && defined(USART2_BASE)
77
   #if defined(PIN_SERIAL2_TX) && defined(USART2_BASE)
75
-    if (peripheral == USART2) {
78
+    else if (peripheral == USART2) {
76
       #ifdef PIN_SERIAL2_RX
79
       #ifdef PIN_SERIAL2_RX
77
         setRx(PIN_SERIAL2_RX);
80
         setRx(PIN_SERIAL2_RX);
78
       #endif
81
       #endif
79
       setTx(PIN_SERIAL2_TX);
82
       setTx(PIN_SERIAL2_TX);
80
-    } else
83
+    }
81
   #endif
84
   #endif
82
   #if defined(PIN_SERIAL3_TX) && defined(USART3_BASE)
85
   #if defined(PIN_SERIAL3_TX) && defined(USART3_BASE)
83
-    if (peripheral == USART3) {
86
+    else if (peripheral == USART3) {
84
       #ifdef PIN_SERIAL3_RX
87
       #ifdef PIN_SERIAL3_RX
85
         setRx(PIN_SERIAL3_RX);
88
         setRx(PIN_SERIAL3_RX);
86
       #endif
89
       #endif
87
       setTx(PIN_SERIAL3_TX);
90
       setTx(PIN_SERIAL3_TX);
88
-    } else
91
+    }
89
   #endif
92
   #endif
90
   #ifdef PIN_SERIAL4_TX
93
   #ifdef PIN_SERIAL4_TX
91
-    if (false
94
+    else if (false
92
       #ifdef USART4_BASE
95
       #ifdef USART4_BASE
93
         || peripheral == USART4
96
         || peripheral == USART4
94
       #elif defined(UART4_BASE)
97
       #elif defined(UART4_BASE)
99
         setRx(PIN_SERIAL4_RX);
102
         setRx(PIN_SERIAL4_RX);
100
       #endif
103
       #endif
101
       setTx(PIN_SERIAL4_TX);
104
       setTx(PIN_SERIAL4_TX);
102
-    } else
105
+    }
103
   #endif
106
   #endif
104
   #ifdef PIN_SERIAL5_TX
107
   #ifdef PIN_SERIAL5_TX
105
-    if (false
108
+    else if (false
106
       #ifdef USART5_BASE
109
       #ifdef USART5_BASE
107
         || peripheral == USART5
110
         || peripheral == USART5
108
       #elif defined(UART5_BASE)
111
       #elif defined(UART5_BASE)
113
         setRx(PIN_SERIAL5_RX);
116
         setRx(PIN_SERIAL5_RX);
114
       #endif
117
       #endif
115
       setTx(PIN_SERIAL5_TX);
118
       setTx(PIN_SERIAL5_TX);
116
-    } else
119
+    }
117
   #endif
120
   #endif
118
   #if defined(PIN_SERIAL6_TX) && defined(USART6_BASE)
121
   #if defined(PIN_SERIAL6_TX) && defined(USART6_BASE)
119
-    if (peripheral == USART6) {
122
+    else if (peripheral == USART6) {
120
       #ifdef PIN_SERIAL6_RX
123
       #ifdef PIN_SERIAL6_RX
121
         setRx(PIN_SERIAL6_RX);
124
         setRx(PIN_SERIAL6_RX);
122
       #endif
125
       #endif
123
         setTx(PIN_SERIAL6_TX);
126
         setTx(PIN_SERIAL6_TX);
124
-    } else
127
+    }
125
   #endif
128
   #endif
126
   #ifdef PIN_SERIAL7_TX
129
   #ifdef PIN_SERIAL7_TX
127
-    if (false
130
+    else if (false
128
       #ifdef USART7_BASE
131
       #ifdef USART7_BASE
129
         || peripheral == USART7
132
         || peripheral == USART7
130
       #elif defined(UART7_BASE)
133
       #elif defined(UART7_BASE)
135
         setRx(PIN_SERIAL7_RX);
138
         setRx(PIN_SERIAL7_RX);
136
       #endif
139
       #endif
137
       setTx(PIN_SERIAL7_TX);
140
       setTx(PIN_SERIAL7_TX);
138
-    } else
141
+    }
139
   #endif
142
   #endif
140
   #ifdef PIN_SERIAL8_TX
143
   #ifdef PIN_SERIAL8_TX
141
-    if (false
144
+    else if (false
142
       #ifdef USART8_BASE
145
       #ifdef USART8_BASE
143
         || peripheral == USART8
146
         || peripheral == USART8
144
       #elif defined(UART8_BASE)
147
       #elif defined(UART8_BASE)
149
         setRx(PIN_SERIAL8_RX);
152
         setRx(PIN_SERIAL8_RX);
150
       #endif
153
       #endif
151
       setTx(PIN_SERIAL8_TX);
154
       setTx(PIN_SERIAL8_TX);
152
-    } else
155
+    }
153
   #endif
156
   #endif
154
   #if defined(PIN_SERIAL9_TX) && defined(UART9_BASE)
157
   #if defined(PIN_SERIAL9_TX) && defined(UART9_BASE)
155
-    if (peripheral == UART9) {
158
+    else if (peripheral == UART9) {
156
       #ifdef PIN_SERIAL9_RX
159
       #ifdef PIN_SERIAL9_RX
157
         setRx(PIN_SERIAL9_RX);
160
         setRx(PIN_SERIAL9_RX);
158
       #endif
161
       #endif
159
       setTx(PIN_SERIAL9_TX);
162
       setTx(PIN_SERIAL9_TX);
160
-    } else
163
+    }
161
   #endif
164
   #endif
162
   #ifdef PIN_SERIAL10_TX
165
   #ifdef PIN_SERIAL10_TX
163
-    if (false
166
+    else if (false
164
       #ifdef USART10_BASE
167
       #ifdef USART10_BASE
165
         || peripheral == USART10
168
         || peripheral == USART10
166
       #elif defined(UART10_BASE)
169
       #elif defined(UART10_BASE)
171
         setRx(PIN_SERIAL10_RX);
174
         setRx(PIN_SERIAL10_RX);
172
       #endif
175
       #endif
173
       setTx(PIN_SERIAL10_TX);
176
       setTx(PIN_SERIAL10_TX);
174
-    } else
177
+    }
175
   #endif
178
   #endif
176
   #if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE)
179
   #if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE)
177
-    if (peripheral == LPUART1) {
180
+    else if (peripheral == LPUART1) {
178
       #ifdef PIN_SERIALLP1_RX
181
       #ifdef PIN_SERIALLP1_RX
179
         setRx(PIN_SERIALLP1_RX);
182
         setRx(PIN_SERIALLP1_RX);
180
       #endif
183
       #endif
181
       setTx(PIN_SERIALLP1_TX);
184
       setTx(PIN_SERIALLP1_TX);
182
-    } else
185
+    }
183
   #endif
186
   #endif
184
   // else get the pins of the first peripheral occurrence in PinMap
187
   // else get the pins of the first peripheral occurrence in PinMap
185
-  {
188
+  else {
186
     _serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
189
     _serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
187
     _serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
190
     _serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
188
   }
191
   }

Загрузка…
Отмена
Сохранить