Added missing flags from ISR, fixed include issues

This commit is contained in:
2025-12-31 17:23:44 -06:00
parent d3e4b9a59e
commit f7bad6f505
5 changed files with 24 additions and 31 deletions

View File

@@ -10,16 +10,13 @@ std::atomic<bool> calibListen{false};
std::atomic<int32_t> baseDiff{0};
std::atomic<int32_t> target{0};
Encoder* topEnc = nullptr;
Encoder* bottomEnc = nullptr;
std::atomic<bool> runningManual{false};
std::atomic<bool> runningServer{false};
std::atomic<bool> clearCalibFlag{false};
std::atomic<bool> savePosFlag{false};
std::atomic<bool> startLess{false};
void servoInit(Encoder& bottom, Encoder& top) {
void servoInit() {
// LEDC timer configuration (C++ aggregate initialization)
ledc_timer_config_t ledc_timer = {};
ledc_timer.speed_mode = LEDC_LOW_SPEED_MODE;
@@ -40,9 +37,6 @@ void servoInit(Encoder& bottom, Encoder& top) {
ledc_channel.hpoint = 0;
ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
topEnc = &top;
bottomEnc = &bottom;
// Configure servo power switch pin as output
gpio_set_direction(servoSwitch, GPIO_MODE_OUTPUT);
gpio_set_level(servoSwitch, 0); // Start with servo power off
@@ -203,12 +197,12 @@ void servoWandListen() {
topEnc->wandListen = false;
}
else if (effDiff > 1) {
servoOn(CCW, manual);
topEnc->wandListen = true;
servoOn(CCW, manual);
}
else if (effDiff < -1) {
servoOn(CW, manual);
topEnc->wandListen = true;
servoOn(CW, manual);
}
else {
servoOff();