@@ -257,6 +257,9 @@ void setup() {
257257 if (!Wire.begin (UM_PROS3 ::I2C_SDA_PIN , UM_PROS3 ::I2C_SCL_PIN )) {
258258 ESP_LOGE (TAG , " Failed to initialize I2C on pins %d (SDA) and %d (SCL)" ,
259259 UM_PROS3 ::I2C_SDA_PIN , UM_PROS3 ::I2C_SCL_PIN );
260+ } else {
261+ // Constant error spam when set to 1
262+ Wire.setTimeOut (2 );
260263 }
261264
262265 loadConfigured = configureLoad ();
@@ -395,22 +398,26 @@ vTaskPollSensors([[maybe_unused]] void *pvParameters) { // NOSONAR
395398 // load.updateSafetyFlag(); // Moved to interrupts before noticing that
396399 // the backoff was the problem, might as well leave it that way
397400
398- static uint32_t backoffFactor =
399- RUN ::TASK_INTERVALS ::FAIL_BACKOFF_BASE_FACTOR ;
400- uint32_t delay_ms = 0 ;
401- if (INA260::updateReadings ()) {
402- backoffFactor = RUN ::TASK_INTERVALS ::FAIL_BACKOFF_BASE_FACTOR ;
403- delay_ms = RUN ::TASK_INTERVALS ::TI_POLL_SENSORS_mS;
404- } else {
405- // Logging already handled
406- delay_ms = RUN ::TASK_INTERVALS ::TI_POLL_SENSORS_mS * backoffFactor;
407- backoffFactor *= RUN ::TASK_INTERVALS ::FAIL_BACKOFF_MULTIPLIER ;
408- }
401+ // static uint32_t backoffFactor =
402+ // RUN::TASK_INTERVALS::FAIL_BACKOFF_BASE_FACTOR;
403+ // uint32_t delay_ms = 0;
404+ // if (INA260::updateReadings()) {
405+ // backoffFactor = RUN::TASK_INTERVALS::FAIL_BACKOFF_BASE_FACTOR;
406+ // delay_ms = RUN::TASK_INTERVALS::TI_POLL_SENSORS_mS;
407+ // } else {
408+ // // Logging already handled
409+ // delay_ms = RUN::TASK_INTERVALS::TI_POLL_SENSORS_mS *
410+ // backoffFactor; backoffFactor *=
411+ // RUN::TASK_INTERVALS::FAIL_BACKOFF_MULTIPLIER;
412+ // }
413+ INA260::updateReadings ();
409414
410- BaseType_t xWasDelayed =
411- xTaskDelayUntil (&xLastWakeTime, pdMS_TO_TICKS (delay_ms));
412- if (xWasDelayed != pdTRUE) {
413- ESP_LOGE (TAG , " Timing not met!" );
415+ BaseType_t xWasDelayed = xTaskDelayUntil (
416+ &xLastWakeTime,
417+ pdMS_TO_TICKS (RUN ::TASK_INTERVALS ::TI_POLL_SENSORS_mS));
418+ // xTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(delay_ms));
419+ if (xWasDelayed == pdFALSE) {
420+ ESP_LOGE (TAG , " Timing" ); // FIXME!
414421 }
415422 }
416423}
0 commit comments