Skip to content

Commit aa21ee3

Browse files
committed
Adjust load logic
1 parent c6bb80d commit aa21ee3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,11 @@ vTaskAdjustLoad([[maybe_unused]] void *pvParameters) { // NOSONAR
420420
// i += 20;
421421
static int_fast32_t lastPower = INT_FAST32_MIN;
422422
static int_fast8_t powerIndex = 46;
423-
if (INA260::current_mA > 0) {
423+
// if (INA260::current_mA > 0) {
424+
if (loadFSM.getCurrentState() != FSMCommon::States::sRunLoad) {
424425
// Don't run at startup
425426
delay(RUN::TASK_INTERVALS::TI_ADJUST_LOAD_mS);
426-
} else if (abs(INA260::dPower_mWPS) > (abs(INA260::power_mW) * 0.05)) {
427+
} else if (abs(INA260::dPower_mWPS) < (abs(INA260::power_mW) * 0.05)) {
427428
// Wait for power to stabilize
428429
} else if ((lastPower == INT_FAST32_MIN) && (powerIndex > 0)) {
429430
powerIndex--;

0 commit comments

Comments
 (0)