瀏覽代碼

Fix raw_filwidth_value error

Scott Lahteine 6 年之前
父節點
當前提交
b220a825a7
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6
    6
      Marlin/src/module/temperature.cpp

+ 6
- 6
Marlin/src/module/temperature.cpp 查看文件

@@ -1679,6 +1679,10 @@ void Temperature::set_current_temp_raw() {
1679 1679
   temp_meas_ready = true;
1680 1680
 }
1681 1681
 
1682
+#if ENABLED(FILAMENT_WIDTH_SENSOR)
1683
+  uint32_t raw_filwidth_value; // = 0
1684
+#endif
1685
+
1682 1686
 void Temperature::readings_ready() {
1683 1687
   // Update the raw values if they've been read. Else we could be updating them during reading.
1684 1688
   if (!temp_meas_ready) set_current_temp_raw();
@@ -1819,10 +1823,6 @@ void Temperature::isr() {
1819 1823
     ISR_STATICS(BED);
1820 1824
   #endif
1821 1825
 
1822
-  #if ENABLED(FILAMENT_WIDTH_SENSOR)
1823
-    static unsigned long raw_filwidth_value = 0;
1824
-  #endif
1825
-
1826 1826
   #if DISABLED(SLOW_PWM_HEATERS)
1827 1827
     constexpr uint8_t pwm_mask =
1828 1828
       #if ENABLED(SOFT_PWM_DITHER)
@@ -2177,8 +2177,8 @@ void Temperature::isr() {
2177 2177
         if (!HAL_ADC_READY())
2178 2178
           next_sensor_state = adc_sensor_state; // redo this state
2179 2179
         else if (HAL_READ_ADC() > 102) { // Make sure ADC is reading > 0.5 volts, otherwise don't read.
2180
-          raw_filwidth_value -= (raw_filwidth_value >> 7); // Subtract 1/128th of the raw_filwidth_value
2181
-          raw_filwidth_value += ((unsigned long)HAL_READ_ADC() << 7); // Add new ADC reading, scaled by 128
2180
+          raw_filwidth_value -= raw_filwidth_value >> 7; // Subtract 1/128th of the raw_filwidth_value
2181
+          raw_filwidth_value += uint32_t(HAL_READ_ADC()) << 7; // Add new ADC reading, scaled by 128
2182 2182
         }
2183 2183
       break;
2184 2184
     #endif

Loading…
取消
儲存