diff --git a/src/module_aat.cpp b/src/module_aat.cpp index 8970e521..ba679b01 100644 --- a/src/module_aat.cpp +++ b/src/module_aat.cpp @@ -115,11 +115,13 @@ void AatModule::Init() #endif _servoPos[IDX_AZIM] = (config.GetAatServoLow(IDX_AZIM) + config.GetAatServoHigh(IDX_AZIM)) / 2; #if defined(PIN_SERVO_AZIM) - _servo_Azim.attach(PIN_SERVO_AZIM, 500, 2500, _servoPos[IDX_AZIM]); + _servo_Azim.attach(PIN_SERVO_AZIM, 500, 2500); + _servo_Azim.write(_servoPos[IDX_AZIM]); #endif _servoPos[IDX_ELEV] = (config.GetAatServoLow(IDX_ELEV) + config.GetAatServoHigh(IDX_ELEV)) / 2; #if defined(PIN_SERVO_ELEV) - _servo_Elev.attach(PIN_SERVO_ELEV, 500, 2500, _servoPos[IDX_ELEV]); + _servo_Elev.attach(PIN_SERVO_ELEV, 500, 2500); + _servo_Elev.write(_servoPos[IDX_ELEV]); #endif #if defined(PIN_OLED_SDA) displayInit(); @@ -673,4 +675,4 @@ void AatModule::Loop(uint32_t now) CrsfModuleBase::Loop(now); } -#endif /* AAT_BACKPACK */ \ No newline at end of file +#endif /* AAT_BACKPACK */ diff --git a/src/module_aat.h b/src/module_aat.h index 26d0716a..aa68ff58 100644 --- a/src/module_aat.h +++ b/src/module_aat.h @@ -7,8 +7,12 @@ #include "devWIFI.h" #if defined(PIN_SERVO_AZIM) || defined(PIN_SERVO_ELEV) +#if defined(ESP32) +#include "ESP32Servo.h" +#else #include #endif +#endif #if defined(PIN_OLED_SDA) #include @@ -124,4 +128,4 @@ class AatModule : public CrsfModuleBase extern AatModule vrxModule; -#endif /* AAT_BACKPACK */ \ No newline at end of file +#endif /* AAT_BACKPACK */ diff --git a/targets/aat.ini b/targets/aat.ini index 283e5d01..fa266815 100644 --- a/targets/aat.ini +++ b/targets/aat.ini @@ -1,6 +1,29 @@ # ******************************** # AAT VRX backpack -- Automatic antenna tracking # ******************************** +[env:AAT_ESP32_Backpack_via_UART] +extends = env_common_esp32 +build_flags = + ${common_env_data.build_flags} + ${env_common_esp32.build_flags} + -D TARGET_VRX_BACKPACK + -D AAT_BACKPACK + -D SSD1306_NO_SPLASH + -D PIN_BUTTON=25 + -D PIN_LED=26 + -D LED_INVERTED + -D PIN_SERVO_AZIM=27 + -D PIN_SERVO_ELEV=14 + -D PIN_OLED_SCL=21 + -D PIN_OLED_SDA=22 + -D DEBUG_LOG +lib_deps = + ${env.lib_deps} + adafruit/Adafruit SSD1306 @ 2.5.9 + madhephaestus/ESP32Servo +build_src_filter = ${common_env_data.build_src_filter} - - - - - - + + [env:AAT_ESP_Backpack_via_UART] extends = env_common_esp12e