Selaa lähdekoodia

🐛 Fix adc_start for AVR, native

Followup to #23295
Scott Lahteine 3 vuotta sitten
vanhempi
commit
00e6e90648
2 muutettua tiedostoa jossa 7 lisäystä ja 5 poistoa
  1. 6
    4
      Marlin/src/HAL/AVR/HAL.h
  2. 1
    1
      Marlin/src/HAL/LINUX/HAL.h

+ 6
- 4
Marlin/src/HAL/AVR/HAL.h Näytä tiedosto

229
   }
229
   }
230
 
230
 
231
   // Begin ADC sampling on the given channel
231
   // Begin ADC sampling on the given channel
232
-  static inline void adc_start(const pin_t ch) {
232
+  static inline void adc_start(const uint8_t ch) {
233
     #ifdef MUX5
233
     #ifdef MUX5
234
-      if (ch > 7) { ADCSRB = _BV(MUX5); return; }
234
+      ADCSRB = ch > 7 ? _BV(MUX5) : 0;
235
+    #else
236
+      ADCSRB = 0;
235
     #endif
237
     #endif
236
-    ADCSRB = 0;
237
-    ADMUX = _BV(REFS0) | (ch & 0x07); SBI(ADCSRA, ADSC);
238
+    ADMUX = _BV(REFS0) | (ch & 0x07);
239
+    SBI(ADCSRA, ADSC);
238
   }
240
   }
239
 
241
 
240
   // Is the ADC ready for reading?
242
   // Is the ADC ready for reading?

+ 1
- 1
Marlin/src/HAL/LINUX/HAL.h Näytä tiedosto

140
   static inline void adc_enable(const uint8_t) {}
140
   static inline void adc_enable(const uint8_t) {}
141
 
141
 
142
   // Begin ADC sampling on the given channel
142
   // Begin ADC sampling on the given channel
143
-  static inline void adc_start(const pin_t ch) { active_ch = ch; }
143
+  static inline void adc_start(const uint8_t ch) { active_ch = ch; }
144
 
144
 
145
   // Is the ADC ready for reading?
145
   // Is the ADC ready for reading?
146
   static inline bool adc_ready() { return true; }
146
   static inline bool adc_ready() { return true; }

Loading…
Peruuta
Tallenna