@@ -439,21 +439,33 @@ vTaskAdjustLoad([[maybe_unused]] void *pvParameters) { // NOSONAR
439439 } else if ((lastPower == INT_FAST32_MIN ) && (powerIndex > 0 )) {
440440 powerIndex--;
441441 load.setLoadGPIO (LOAD ::RES_INDEX_TABLE [powerIndex]);
442+ ESP_LOGD (TAG , " Last power: %d mW, current power: %d mW" ,
443+ static_cast <int >(lastPower),
444+ static_cast <int >(INA260 ::power_mW));
442445 ESP_LOGI (TAG , " Initial load adjustment, setpoint: %d" ,
443446 LOAD ::RES_INDEX_TABLE [powerIndex]);
444447 } else if ((INA260 ::power_mW > lastPower) && (powerIndex > 0 )) {
445448 powerIndex--;
446449 load.setLoadGPIO (LOAD ::RES_INDEX_TABLE [powerIndex]);
450+ ESP_LOGD (TAG , " Last power: %d mW, current power: %d mW" ,
451+ static_cast <int >(lastPower),
452+ static_cast <int >(INA260 ::power_mW));
447453 ESP_LOGI (TAG , " Decreasing load to %d" ,
448454 LOAD ::RES_INDEX_TABLE [powerIndex]);
449455 } else if ((INA260 ::power_mW < lastPower) && (powerIndex < 46 )) {
450456 powerIndex++;
451457 load.setLoadGPIO (LOAD ::RES_INDEX_TABLE [powerIndex]);
458+ ESP_LOGI (TAG , " Last power: %d mW, current power: %d mW" ,
459+ static_cast <int >(lastPower),
460+ static_cast <int >(INA260 ::power_mW));
452461 ESP_LOGI (TAG , " Increasing load to %d" ,
453462 LOAD ::RES_INDEX_TABLE [powerIndex]);
454463 delay (20 *
455464 1000 ); // todo RUN::TASK_INTERVALS::TI_ADJUST_LOAD_mS * 100
456- } // todo: change trigger to when rpm changes or when power changes
465+ } else { // todo: change trigger to when rpm changes or when power
466+ // changes
467+ // No change
468+ }
457469 lastPower = INA260 ::power_mW;
458470
459471 delay (RUN ::TASK_INTERVALS ::TI_ADJUST_LOAD_mS);
0 commit comments