소스 검색

Add current offset for POWER_MONITOR sensor (#18600)

cccc 4 년 전
부모
커밋
b64113411c
No account linked to committer's email address
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 1
    0
      Marlin/Configuration_adv.h
  2. 1
    1
      Marlin/src/feature/power_monitor.h

+ 1
- 0
Marlin/Configuration_adv.h 파일 보기

3029
 //#define POWER_MONITOR_VOLTAGE   // Monitor the system voltage
3029
 //#define POWER_MONITOR_VOLTAGE   // Monitor the system voltage
3030
 #if EITHER(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE)
3030
 #if EITHER(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE)
3031
   #define POWER_MONITOR_VOLTS_PER_AMP   0.05000   // Input voltage to the MCU analog pin per amp  - DO NOT apply more than ADC_VREF!
3031
   #define POWER_MONITOR_VOLTS_PER_AMP   0.05000   // Input voltage to the MCU analog pin per amp  - DO NOT apply more than ADC_VREF!
3032
+  #define POWER_MONITOR_CURRENT_OFFSET -1         // Offset value for current sensors with linear function output  
3032
   #define POWER_MONITOR_VOLTS_PER_VOLT  0.11786   // Input voltage to the MCU analog pin per volt - DO NOT apply more than ADC_VREF!
3033
   #define POWER_MONITOR_VOLTS_PER_VOLT  0.11786   // Input voltage to the MCU analog pin per volt - DO NOT apply more than ADC_VREF!
3033
   #define POWER_MONITOR_FIXED_VOLTAGE   13.6      // Voltage for a current sensor with no voltage sensor (for power display)
3034
   #define POWER_MONITOR_FIXED_VOLTAGE   13.6      // Voltage for a current sensor with no voltage sensor (for power display)
3034
 #endif
3035
 #endif

+ 1
- 1
Marlin/src/feature/power_monitor.h 파일 보기

35
     filter_buf = filter_buf - (filter_buf >> K_VALUE) + (uint32_t(sample) << K_SCALE);
35
     filter_buf = filter_buf - (filter_buf >> K_VALUE) + (uint32_t(sample) << K_SCALE);
36
   }
36
   }
37
   void capture() {
37
   void capture() {
38
-    value = filter_buf * (SCALE * (1.0f / (1UL << (PM_K_VALUE + PM_K_SCALE))));
38
+    value = filter_buf * (SCALE * (1.0f / (1UL << (PM_K_VALUE + PM_K_SCALE)))) + (POWER_MONITOR_CURRENT_OFFSET);
39
   }
39
   }
40
   void reset(uint16_t reset_value = 0) {
40
   void reset(uint16_t reset_value = 0) {
41
     filter_buf = uint32_t(reset_value) << (K_VALUE + K_SCALE);
41
     filter_buf = uint32_t(reset_value) << (K_VALUE + K_SCALE);

Loading…
취소
저장