Add current offset for POWER_MONITOR sensor (#18600)

This commit is contained in:
cccc authored and GitHub committed 2020-07-09 22:43:04 -05:00
1 parent 0f64e7912f
commit b64113411c
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ struct pm_lpf_t {
filter_buf = filter_buf - (filter_buf >> K_VALUE) + (uint32_t(sample) << K_SCALE);
}
void capture() {
value = filter_buf * (SCALE * (1.0f / (1UL << (PM_K_VALUE + PM_K_SCALE))));
value = filter_buf * (SCALE * (1.0f / (1UL << (PM_K_VALUE + PM_K_SCALE)))) + (POWER_MONITOR_CURRENT_OFFSET);
}
void reset(uint16_t reset_value = 0) {
filter_buf = uint32_t(reset_value) << (K_VALUE + K_SCALE);