revert to non-task-driven, no tangible difference in performance. May change back later.

This commit is contained in:
2026-01-08 18:14:36 -06:00
parent e437c32c28
commit 03ca64080c
15 changed files with 240 additions and 435 deletions

View File

@@ -3,7 +3,6 @@
#include "esp_log.h"
#include "soc/gpio_struct.h"
#include "servo.hpp"
#include "defines.h"
static const char *TAG = "ENCODER";
@@ -49,32 +48,26 @@ void IRAM_ATTR Encoder::isr_handler(void* arg)
if (encoder->last_count_base > 3) {
encoder->count += 1;
encoder->last_count_base -= 4;
// DEFER to task via queue instead of direct function calls
encoder_event_t event = {
.count = encoder->count.load(),
.is_top_encoder = (encoder == topEnc)
};
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (g_encoder_event_queue != NULL) {
xQueueSendFromISR(g_encoder_event_queue, &event, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
if (calibListen) servoCalibListen();
if (encoder->feedWDog) {
esp_timer_stop(encoder->watchdog_handle);
esp_timer_start_once(encoder->watchdog_handle, 500000);
debugLEDTgl();
}
if (encoder->wandListen) servoWandListen();
if (encoder->serverListen) servoServerListen();
}
else if (encoder->last_count_base < 0) {
encoder->count -= 1;
encoder->last_count_base += 4;
// DEFER to task via queue instead of direct function calls
encoder_event_t event = {
.count = encoder->count.load(),
.is_top_encoder = (encoder == topEnc)
};
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (g_encoder_event_queue != NULL) {
xQueueSendFromISR(g_encoder_event_queue, &event, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
if (calibListen) servoCalibListen();
if (encoder->feedWDog) {
esp_timer_stop(encoder->watchdog_handle);
esp_timer_start_once(encoder->watchdog_handle, 500000);
debugLEDTgl();
}
if (encoder->wandListen) servoWandListen();
if (encoder->serverListen) servoServerListen();
}
encoder->last_state_a = current_a;