From a58fb49baa13f45e0c7d6b603e98127b9911000d Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Tue, 3 Jun 2025 09:09:13 +0200 Subject: [PATCH 01/24] add OAE config --- Changelog.md | 3 + Configuration.hpp | 2 + ConfigurationValidation.hpp | 18 ++-- Configuration_adv.hpp | 21 +---- Constants.hpp | 1 + Version.h | 2 +- boards/ESP32_ESP32DEV/pins_OAE_V1.hpp | 124 ++++++++++++++++++++++++++ platformio.ini | 6 ++ src/Mount.cpp | 20 +++-- src/Mount.hpp | 3 +- src/b_setup.hpp | 5 ++ 11 files changed, 173 insertions(+), 32 deletions(-) create mode 100644 boards/ESP32_ESP32DEV/pins_OAE_V1.hpp diff --git a/Changelog.md b/Changelog.md index 659ee6fe..7e7e04ba 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,6 @@ +**V1.13.15 - Updates** + - changes necessary for OAE, add OAE baord + **V1.13.15 - Updates** - Check `INFO_DISPLAY_TYPE` builds in CI - Fix `INFO_DISPLAY_TYPE_I2C_SSD1306_128x64` for esp32 builds diff --git a/Configuration.hpp b/Configuration.hpp index 95585a71..a62e5c50 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -260,6 +260,8 @@ #include "boards/RAMPS/pins_RAMPS.hpp" #elif (BOARD == BOARD_ESP32_ESP32DEV) #include "boards/ESP32_ESP32DEV/pins_ESP32DEV.hpp" +#elif (BOARD == BOARD_OAE_V1) + #include "boards/ESP32_ESP32DEV/pins_OAE_V1.hpp" #elif (BOARD == BOARD_AVR_MKS_GEN_L_V1) #include "boards/AVR_MKS_GEN_L_V1/pins_MKS_GEN_L_V1.h" #elif (BOARD == BOARD_AVR_MKS_GEN_L_V2) diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp index 6660e854..74667a10 100644 --- a/ConfigurationValidation.hpp +++ b/ConfigurationValidation.hpp @@ -89,6 +89,9 @@ #error AZ driver address for DRIVER_TYPE_TMC2209_UART not specified. #endif #endif +#elif defined(BOARD_OAE_V1) + // Valid + #else #error Configuration does not support AZ. Use at own risk. @@ -110,6 +113,9 @@ #endif #endif +#elif defined(BOARD_OAE_V1) + // Valid + #else #warning Configuration does not support ALT. Use at own risk. #endif @@ -193,7 +199,7 @@ #warning Missing pin assignments for MS pins #endif #elif (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if !defined(DEC_STEP_PIN) || !defined(DEC_DIR_PIN) || !defined(DEC_EN_PIN) || !defined(DEC_DIAG_PIN) + #if !defined(DEC_STEP_PIN) || !defined(DEC_DIR_PIN) || !defined(DEC_EN_PIN) // Required pin assignments missing #error Missing pin assignments for configured DEC DRIVER_TYPE_TMC2209_UART driver #endif @@ -213,7 +219,7 @@ #warning Missing pin assignments for MS pins #endif #elif (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if !defined(RA_STEP_PIN) || !defined(RA_DIR_PIN) || !defined(RA_EN_PIN) || !defined(RA_DIAG_PIN) + #if !defined(RA_STEP_PIN) || !defined(RA_DIR_PIN) || !defined(RA_EN_PIN) // Required pin assignments missing #error Missing pin assignments for configured RA DRIVER_TYPE_TMC2209_UART driver #endif @@ -225,12 +231,12 @@ #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) #if (AZ_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE) - #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) || !defined(AZ_DIAG_PIN) + #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) // Required pin assignments missing #error Missing pin assignments for configured AZ DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver #endif #elif (AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) || !defined(AZ_DIAG_PIN) + #if !defined(AZ_STEP_PIN) || !defined(AZ_DIR_PIN) || !defined(AZ_EN_PIN) // Required pin assignments missing (ATmega uses SoftwareSerial for this driver) #error Missing pin assignments for configured AZ DRIVER_TYPE_TMC2209_UART driver #endif @@ -243,12 +249,12 @@ #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) #if (ALT_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC) || (ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE) - #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) || !defined(ALT_DIAG_PIN) + #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) // Required pin assignments missing #error Missing pin assignments for configured AZ DRIVER_TYPE_A4988_GENERIC or DRIVER_TYPE_TMC2209_STANDALONE driver #endif #elif (ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) || !defined(ALT_DIAG_PIN) + #if !defined(ALT_STEP_PIN) || !defined(ALT_DIR_PIN) || !defined(ALT_EN_PIN) // Required pin assignments missing (ATmega uses SoftwareSerial for this driver) #error Missing pin assignments for configured ALT DRIVER_TYPE_TMC2209_UART driver #endif diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index e03ec5a4..0de0b148 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -341,7 +341,10 @@ (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / (AZ_PULLEY_TEETH * GT2_BELT_PITCH)) * AZ_STEPPER_SPR \ * AZ_MICROSTEPPING) // Actually u-steps/rev #endif - #define AZIMUTH_STEPS_PER_ARC_MINUTE (AZIMUTH_STEPS_PER_REV / (360 * 60.0f)) // Used to determine move distance in steps + + #ifndef AZIMUTH_STEPS_PER_ARC_MINUTE + #define AZIMUTH_STEPS_PER_ARC_MINUTE (AZIMUTH_STEPS_PER_REV / (360 * 60.0f)) // Used to determine move distance in steps + #endif // AZ TMC2209 UART settings // These settings work only with TMC2209 in UART connection (single wire to TX) @@ -618,22 +621,6 @@ // //////// //////////////////////////////////////////// -// Stepper drivers -#if (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if defined(ESP32) - #define RA_SERIAL_PORT Serial2 // Can be shared with DEC_SERIAL_PORT - #elif defined(__AVR_ATmega2560__) - // Uses SoftwareSerial - #endif -#endif - -#if (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if defined(ESP32) - #define DEC_SERIAL_PORT Serial2 // Can be shared with RA_SERIAL_PORT - #elif defined(__AVR_ATmega2560__) - // Uses SoftwareSerial - #endif -#endif // Focuser #if (FOCUS_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) diff --git a/Constants.hpp b/Constants.hpp index 30dc104c..17c00429 100644 --- a/Constants.hpp +++ b/Constants.hpp @@ -18,6 +18,7 @@ // ESP32 based boards #define BOARD_ESP32_ESP32DEV 1001 +#define BOARD_OAE_V1 1002 /** * Supported keypad/display types. Use one of these values for DISPLAY_TYPE configuration matching your used display and keypad. diff --git a/Version.h b/Version.h index 81278909..e069b894 100644 --- a/Version.h +++ b/Version.h @@ -3,4 +3,4 @@ // Also, numbers are interpreted as simple numbers. _ __ _ // So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/ -#define VERSION "V1.13.15" +#define VERSION "V1.13.16" diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp new file mode 100644 index 00000000..2b1de9ab --- /dev/null +++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp @@ -0,0 +1,124 @@ +/** + * @brief a pins configuration file for an OAE board v1.0 + */ + +#pragma once + +/** + * @brief a pins configuration file for an ESP32-based OAT. + */ + +#pragma once + +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering +#ifndef RA_STEP_PIN + #define RA_STEP_PIN 14 // STEP +#endif +#ifndef RA_DIR_PIN + #define RA_DIR_PIN 26 // DIR +#endif +#ifndef RA_EN_PIN + #define RA_EN_PIN 27 // Enable +#endif + +// DRIVER_TYPE_TMC2209_UART HardwareSerial port, can be shared across all drivers +#ifndef RA_SERIAL_PORT + #define RA_SERIAL_PORT Serial1 +#endif +#ifndef RA_DRIVER_ADDRESS + #define RA_DRIVER_ADDRESS 0b00 // Set by MS1/MS2. LOW/LOW in this case +#endif +// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering +#ifndef DEC_STEP_PIN + #define DEC_STEP_PIN 25 // STEP +#endif +#ifndef DEC_DIR_PIN + #define DEC_DIR_PIN 5 // DIR +#endif +#ifndef DEC_EN_PIN + #define DEC_EN_PIN 33 // Enable +#endif + +// DRIVER_TYPE_TMC2209_UART HardwareSerial port, can be shared across all drivers +#ifndef DEC_SERIAL_PORT + #define DEC_SERIAL_PORT Serial1 // SoftwareSerial TX port +#endif +#ifndef DEC_DRIVER_ADDRESS + #define DEC_DRIVER_ADDRESS 0b01 // Set by MS1/MS2 (MS1 HIGH, MS2 LOW) +#endif + +#define SW_SERIAL_UART 0 + +#ifndef ALT_STEP_PIN + #define ALT_STEP_PIN 13 // STEP +#endif +#ifndef ALT_DIR_PIN + #define ALT_DIR_PIN 23 // DIR +#endif +#ifndef ALT_EN_PIN + #define ALT_EN_PIN 4 // Enable +#endif + +#ifndef AZ_STEP_PIN + #define AZ_STEP_PIN 18 // STEP +#endif +#ifndef AZ_DIR_PIN + #define AZ_DIR_PIN 19 // DIR +#endif +#ifndef AZ_EN_PIN + #define AZ_EN_PIN 32 // Enable +#endif + +// DISPLAY_TYPE_LCD_JOY_I2C_SSD1306 requires 3 analog inputs in Arduino pin numbering +#ifndef LCD_KEY_SENSE_X_PIN + //#define LCD_KEY_SENSE_X_PIN 34 +#endif +#ifndef LCD_KEY_SENSE_Y_PIN + //#define LCD_KEY_SENSE_Y_PIN 39 +#endif +#ifndef LCD_KEY_SENSE_PUSH_PIN + //#define LCD_KEY_SENSE_PUSH_PIN 36 +#endif + +//Serial port for external debugging +#if DEBUG_SEPARATE_SERIAL == 1 + #ifndef DEBUG_SERIAL_PORT + #error "There is no default separate serial port for ESP32, please define DEBUG_SERIAL_PORT" + #endif +#else + #ifndef DEBUG_SERIAL_PORT + #define DEBUG_SERIAL_PORT Serial2 + #endif +#endif + + +// Defines for OAE /////////////////////// +#define OAM //enable GEM Motion + +#ifndef RA_WHEEL_CIRCUMFERENCE + #define RA_WHEEL_CIRCUMFERENCE 704.97f +#endif +#ifndef DEC_TRANSMISSION + #define DEC_TRANSMISSION (DEC_WHEEL_CIRCUMFERENCE / (DEC_PULLEY_TEETH * 1.0)) +#endif +#ifndef RA_LIMIT_LEFT + #define RA_LIMIT_LEFT 5.0f +#endif +#ifndef RA_LIMIT_RIGHT + #define RA_LIMIT_RIGHT 7.0f +#endif +#ifndef RA_TRACKING_LIMIT + #define RA_TRACKING_LIMIT 6.75f +#endif +#ifndef DEC_WHEEL_CIRCUMFERENCE + #define DEC_WHEEL_CIRCUMFERENCE 1.0f +#endif +#ifndef RA_STEPPER_SPR + #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper +#endif +#ifndef DEC_STEPPER_SPR + #define DEC_STEPPER_SPR (200 * 50 * 4.5f) // change to (200 * 9) for 1.8° stepper +#endif +#ifndef DEC_PULLEY_TEETH + #define DEC_PULLEY_TEETH 1 +#endif \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 9f81e979..b23a21da 100644 --- a/platformio.ini +++ b/platformio.ini @@ -128,6 +128,12 @@ lib_deps = ${common.lib_deps} WiFi +[env:oaeboardv1] +extends = env:esp32 +build_flags = + ${env.build_flags} + -D BOARD=BOARD_OAE_V1 -D ESP32BOARD + [env:native] platform = native test_ignore = test_embedded diff --git a/src/Mount.cpp b/src/Mount.cpp index 6ff13987..806d49c9 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -1579,11 +1579,14 @@ void Mount::stopGuiding(bool ra, bool dec) // Stop DEC guiding and wait for it to stop. _stepperGUIDE->stop(); + #if !defined(ESP32BOARD) while (_stepperGUIDE->isRunning()) { _stepperGUIDE->run(); _stepperTRK->runSpeed(); } + #endif + _mountStatus &= ~STATUS_GUIDE_PULSE_DEC; } @@ -1880,11 +1883,11 @@ void Mount::getAZALTPositions(long &azPos, long &altPos) void Mount::moveAZALTToHome() { #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) - enableAzAltMotors(); + enableAzMotor(); _stepperAZ->moveTo(0); #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - enableAzAltMotors(); + enableAltMotor(); _stepperALT->moveTo(0); #endif } @@ -1979,7 +1982,7 @@ void Mount::moveBy(int direction, float arcMinutes) #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) if (direction == AZIMUTH_STEPS) { - enableAzAltMotors(); + enableAzMotor(); long stepsToMove = arcMinutes * AZIMUTH_STEPS_PER_ARC_MINUTE; _stepperAZ->move(stepsToMove); } @@ -1987,7 +1990,7 @@ void Mount::moveBy(int direction, float arcMinutes) #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) if (direction == ALTITUDE_STEPS) { - enableAzAltMotors(); + enableAltMotor(); long stepsToMove = arcMinutes * ALTITUDE_STEPS_PER_ARC_MINUTE; _stepperALT->move(stepsToMove); } @@ -2040,12 +2043,15 @@ void Mount::disableAzAltMotors() // enableAzAltMotors // ///////////////////////////////// -void Mount::enableAzAltMotors() +void Mount::enableAzMotor() { #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) digitalWrite(AZ_EN_PIN, LOW); // Logic LOW to enable driver #endif +} +void Mount::enableAltMotor() +{ #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) digitalWrite(ALT_EN_PIN, LOW); // Logic LOW to enable driver #endif @@ -3692,7 +3698,7 @@ void Mount::moveStepperBy(StepperAxis direction, long steps) case AZIMUTH_STEPS: { #if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE - enableAzAltMotors(); + enableAzMotor(); LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: AZ from %l to %l", _stepperAZ->currentPosition(), @@ -3705,7 +3711,7 @@ void Mount::moveStepperBy(StepperAxis direction, long steps) case ALTITUDE_STEPS: { #if ALT_STEPPER_TYPE != STEPPER_TYPE_NONE - enableAzAltMotors(); + enableAltMotor(); _stepperALT->moveTo(_stepperALT->currentPosition() + steps); #endif } diff --git a/src/Mount.hpp b/src/Mount.hpp index 80d53351..1dbb227d 100644 --- a/src/Mount.hpp +++ b/src/Mount.hpp @@ -432,7 +432,8 @@ class Mount // Support for moving the mount in azimuth and altitude (requires extra hardware) void moveBy(int direction, float arcMinutes); void disableAzAltMotors(); - void enableAzAltMotors(); + void enableAzMotor(); + void enableAltMotor(); #endif #if (FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE) diff --git a/src/b_setup.hpp b/src/b_setup.hpp index cd99525e..42b06e16 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -175,7 +175,10 @@ void setup() #endif #if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART // include TMC2209 UART pins + #if defined(RA_DIAG_PIN) pinMode(RA_DIAG_PIN, INPUT); + #endif + #ifdef RA_SERIAL_PORT RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif @@ -195,7 +198,9 @@ void setup() #endif #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART // include TMC2209 UART pins + #if defined(DEC_DIAG_PIN) pinMode(DEC_DIAG_PIN, INPUT); + #endif #ifdef DEC_SERIAL_PORT DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif From 2e58455b4ab13bcbfb78c6226916a09eed0a35ea Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Tue, 3 Jun 2025 09:51:02 +0200 Subject: [PATCH 02/24] RA DEC driver serial connection --- boards/ESP32_ESP32DEV/pins_OAE_V1.hpp | 12 ++++++++++++ src/b_setup.hpp | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp index 2b1de9ab..60d962f8 100644 --- a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp +++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp @@ -25,6 +25,12 @@ #ifndef RA_SERIAL_PORT #define RA_SERIAL_PORT Serial1 #endif +#ifndef RA_TX_PIN + #define RA_TX_PIN 17 +#endif +#ifndef RA_RX_PIN + #define RA_RX_PIN 16 +#endif #ifndef RA_DRIVER_ADDRESS #define RA_DRIVER_ADDRESS 0b00 // Set by MS1/MS2. LOW/LOW in this case #endif @@ -43,6 +49,12 @@ #ifndef DEC_SERIAL_PORT #define DEC_SERIAL_PORT Serial1 // SoftwareSerial TX port #endif +#ifndef DEC_TX_PIN + #define DEC_TX_PIN 17 +#endif +#ifndef DEC_RX_PIN + #define DEC_RX_PIN 16 +#endif #ifndef DEC_DRIVER_ADDRESS #define DEC_DRIVER_ADDRESS 0b01 // Set by MS1/MS2 (MS1 HIGH, MS2 LOW) #endif diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 42b06e16..05be1194 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -180,7 +180,12 @@ void setup() #endif #ifdef RA_SERIAL_PORT - RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + #if defined(BOARD_OAE_V1) + RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); + #else + RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + #endif + // #endif #endif pinMode(DEC_EN_PIN, OUTPUT); @@ -199,10 +204,14 @@ void setup() #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART // include TMC2209 UART pins #if defined(DEC_DIAG_PIN) - pinMode(DEC_DIAG_PIN, INPUT); + pinMode(DEC_DIAG_PIN, INPUT); #endif #ifdef DEC_SERIAL_PORT - DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + #if defined(BOARD_OAE_V1) + DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); + #else + DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + #endif #endif #endif From e7f41da5a16e0029983f64937e0ae3bc1cf463f1 Mon Sep 17 00:00:00 2001 From: Lutz Date: Sun, 6 Jul 2025 23:09:08 -0700 Subject: [PATCH 03/24] WIP Updates - OAE support - AZ/ALT debug output - Stop button now stop all motors (incl. AZ and ALT) --- Changelog.md | 4 +-- Configuration_adv.hpp | 63 ++++++++++++++++++++++++---------- src/MeadeCommandProcessor.cpp | 5 ++- src/Mount.cpp | 31 +++++++++++++++-- src/Mount.hpp | 3 ++ src/SSD1306_128x64_Display.hpp | 10 +++--- src/b_setup.hpp | 12 +++++++ src/testmenu.cpp | 14 ++++++-- src/testmenudef.hpp | 2 +- 9 files changed, 112 insertions(+), 32 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7e7e04ba..97924f34 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,5 @@ **V1.13.15 - Updates** - - changes necessary for OAE, add OAE baord - -**V1.13.15 - Updates** +- Changes necessary for OAE, add OAE baord - Check `INFO_DISPLAY_TYPE` builds in CI - Fix `INFO_DISPLAY_TYPE_I2C_SSD1306_128x64` for esp32 builds diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index 0de0b148..df1b12a9 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -232,14 +232,14 @@ #endif #ifndef DEC_LIMIT_UP - #ifdef OAM + #if defined(OAM) || defined(OAE) #define DEC_LIMIT_UP 135.0f #else #define DEC_LIMIT_UP 0.0f #endif #endif #ifndef DEC_LIMIT_DOWN - #ifdef OAM + #if defined(OAM) || defined(OAE) #define DEC_LIMIT_DOWN 135.0f #else #define DEC_LIMIT_DOWN 0.0f @@ -332,14 +332,28 @@ #define AZ_STEPPER_ACCELERATION (100 * AZ_MICROSTEPPING) #endif - // the Circumference of the AZ rotation. 808mm dia. + // the Circumference of the AZ rotation. 808mm dia (OAT) #ifndef AZ_CIRCUMFERENCE - #define AZ_CIRCUMFERENCE 2538.4f + #ifdef OAE + // Roughly from the joint to the rod placement is 70mm + #define AZ_CIRCUMFERENCE 70.0f * 2 * PI + #else + #define AZ_CIRCUMFERENCE 2538.4f + #endif #endif + + #ifdef OAE + #ifndef AZ_WORMGEAR_RATIO + #define AZ_WORMGEAR_RATIO (40.0f) + #endif + #else + #define AZ_WORMGEAR_RATIO 1.0f + #endif + #ifndef AZIMUTH_STEPS_PER_REV #define AZIMUTH_STEPS_PER_REV \ (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / (AZ_PULLEY_TEETH * GT2_BELT_PITCH)) * AZ_STEPPER_SPR \ - * AZ_MICROSTEPPING) // Actually u-steps/rev + * AZ_MICROSTEPPING * AZ_WORMGEAR_RATIO) // Actually u-steps/rev #endif #ifndef AZIMUTH_STEPS_PER_ARC_MINUTE @@ -398,20 +412,33 @@ #define ALTITUDE_STEPS_PER_REV \ (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev - #else - // the Circumference of the AZ rotation. 770mm dia. - #define ALT_CIRCUMFERENCE 2419.0f - #if AUTOPA_VERSION == 1 - // the ratio of the ALT gearbox for AutoPA V1 (40:3) - #define ALT_WORMGEAR_RATIO (40.0f / 3.0f) + #else + #ifdef OAE + #ifndef ALT_ROD_PITCH + #define ALT_ROD_PITCH 1.25 // mm/rev + #endif + // the Circumference of the ALT rotation. Roughly 146mm radius. + #define ALT_CIRCUMFERENCE 146.0f * 2 * PI + #ifndef ALT_WORMGEAR_RATIO + #define ALT_WORMGEAR_RATIO (40.0f) + #endif + #define ALTITUDE_STEPS_PER_REV + \ + (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING * ALT_WORMGEAR_RATIO) // Actually u-steps/rev #else - // the ratio of the ALT gearbox for AutoPA V2 (40:1) - #define ALT_WORMGEAR_RATIO (40.0f) - #endif - #ifndef ALTITUDE_STEPS_PER_REV - #define ALTITUDE_STEPS_PER_REV \ - (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR * ALT_MICROSTEPPING \ - * ALT_WORMGEAR_RATIO) // Actually u-steps/rev + // the Circumference of the AZ rotation. 770mm dia. + #define ALT_CIRCUMFERENCE 2419.0f + #if AUTOPA_VERSION == 1 + // the ratio of the ALT gearbox for AutoPA V1 (40:3) + #define ALT_WORMGEAR_RATIO (40.0f / 3.0f) + #else + // the ratio of the ALT gearbox for AutoPA V2 (40:1) + #define ALT_WORMGEAR_RATIO (40.0f) + #endif + #ifndef ALTITUDE_STEPS_PER_REV + #define ALTITUDE_STEPS_PER_REV \ + (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR * ALT_MICROSTEPPING \ + * ALT_WORMGEAR_RATIO) // Actually u-steps/rev + #endif #endif #endif diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp index e06b984e..84794202 100644 --- a/src/MeadeCommandProcessor.cpp +++ b/src/MeadeCommandProcessor.cpp @@ -2069,7 +2069,10 @@ String MeadeCommandProcessor::handleMeadeQuit(String inCmd) if (inCmd.length() == 0) { _mount->stopSlewing(ALL_DIRECTIONS | TRACKING); - _mount->waitUntilStopped(ALL_DIRECTIONS); + _mount->stopSlewing(AZIMUTH_STEPS); + _mount->stopSlewing(ALTITUDE_STEPS); + _mount->stopSlewing(FOCUS_STEPS); + _mount->waitUntilAllStopped(); return ""; } diff --git a/src/Mount.cpp b/src/Mount.cpp index 806d49c9..e7b3b9e9 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -1245,7 +1245,7 @@ void Mount::setLST(const DayTime &lst) { _LST = lst; _zeroPosRA = lst; -#ifdef OAM +#if defined(OAM) || defined(OAE) _zeroPosRA.addHours(6); // shift allcoordinates by 90° for EQ mount movement #endif LOG(DEBUG_MOUNT, "[MOUNT]: Set LST and ZeroPosRA to: %s", _LST.ToString()); @@ -2628,6 +2628,33 @@ void Mount::waitUntilStopped(byte direction) } } +///////////////////////////////// +// +// waitUntilAllStopped +// +///////////////////////////////// +// Block until all steppers are stopped +void Mount::waitUntilAllStopped() +{ + while (_stepperRA->isRunning() + || _stepperDEC->isRunning() + || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) +#if FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE + || _stepperFocus->isRunning() +#endif +#if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE + || _stepperAZ->isRunning() +#endif +#if ALT_STEPPER_TYPE != STEPPER_TYPE_NONE + || _stepperALT->isRunning() +#endif + ) + { + loop(); + yield(); + } +} + ///////////////////////////////// // // getCurrentStepperPosition @@ -3365,7 +3392,7 @@ void Mount::setHome(bool clearZeroPos) //LOG(DEBUG_MOUNT_VERBOSE, "[MOUNT]: setHomePre: targetRA is %s", targetRA().ToString()); //LOG(DEBUG_MOUNT_VERBOSE, "[MOUNT]: setHomePre: zeroPos is %s", _zeroPosRA.ToString()); _zeroPosRA = clearZeroPos ? DayTime(POLARIS_RA_HOUR, POLARIS_RA_MINUTE, POLARIS_RA_SECOND) : calculateLst(); -#ifdef OAM +#if defined(OAM) || defined(OAE) _zeroPosRA.addHours(6); // shift allcoordinates by 90° for EQ mount movement #endif _zeroPosDEC = 0.0f; diff --git a/src/Mount.hpp b/src/Mount.hpp index 1dbb227d..b84a73c8 100644 --- a/src/Mount.hpp +++ b/src/Mount.hpp @@ -335,6 +335,9 @@ class Mount // Block until the motors specified (NORTH, EAST, TRACKING, etc.) are stopped void waitUntilStopped(byte direction); + // Block until all motors are stopped + void waitUntilAllStopped(); + // Same as Arduino delay() but keeps the tracker going. void delay(int ms); diff --git a/src/SSD1306_128x64_Display.hpp b/src/SSD1306_128x64_Display.hpp index 003f32cc..bb036fee 100644 --- a/src/SSD1306_128x64_Display.hpp +++ b/src/SSD1306_128x64_Display.hpp @@ -23,7 +23,7 @@ const uint8_t sineTable[] PROGMEM = {0, 22, 44, 66, 87, 108, 128, 146, 164, 180, // This class renders the mount status to a 128x64 pixel display controlled by a SSD1306 chip. class SDD1306OLED128x64 : public InfoDisplayRender { -#ifdef OAM +#if defined(OAM) || defined(OAE) const float bottomDEC = -180.0f; const float rangeDEC = 360.0; #else @@ -92,7 +92,9 @@ class SDD1306OLED128x64 : public InfoDisplayRender // Name on the right display->setFont(Bitmap5x7); -#ifdef OAM +#ifdef OAE + display->drawString(32, 6, F("OpenAstroExplorer")); +#elif defined(OAM) display->drawString(32, 6, F("OpenAstroMount")); #else display->drawString(32, 6, F("OpenAstroTracker")); @@ -375,7 +377,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender { display->setPixel(_decScalePos, p); } -#ifdef OAM +#if defined(OAM) || defined(OAE) display->drawHorizontalLine(_decScalePos - 1, yDECPixel(-180.0), 2); #endif display->drawHorizontalLine(_decScalePos - 1, yDECPixel(-90.0), 2); @@ -383,7 +385,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender display->drawHorizontalLine(_decScalePos - 1, yDECPixel(90.0), 2); display->drawHorizontalLine(_decScalePos - 1, yDECPixel(180.0), 2); // DEC tickmark labels -#ifdef OAM +#if defined(OAM) || defined(OAE) display->drawString(_decScalePos + 6, yDECPixel(-180.0f) - 2, F("180")); display->drawHorizontalLine(_decScalePos + 3, yDECPixel(-180.0), 2); // Smaller minus sign #endif diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 05be1194..f3c7f2c6 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -433,6 +433,12 @@ void setup() #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) LOG(DEBUG_ANY, "[STEPPERS]: Configure AZ stepper..."); + LOG(DEBUG_ANY, "[STEPPERS]: AZ Microsteps : %d", AZ_MICROSTEPPING); + LOG(DEBUG_ANY, "[STEPPERS]: AZ Stepper SPR : %d", AZ_STEPPER_SPR); + LOG(DEBUG_ANY, "[STEPPERS]: AZ Circumference : %f", AZ_CIRCUMFERENCE); + LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/rev : %f", AZIMUTH_STEPS_PER_REV); + LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/deg : %f", _stepsPerAZDegree); + LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/minute : %f", AZIMUTH_STEPS_PER_ARC_MINUTE); mount.configureAZStepper(AZmotorPin1, AZmotorPin2, AZ_STEPPER_SPEED, AZ_STEPPER_ACCELERATION); #if AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART LOG(DEBUG_ANY, "[STEPPERS]: Configure AZ driver..."); @@ -445,6 +451,12 @@ void setup() #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) LOG(DEBUG_ANY, "[STEPPERS]: Configure Alt stepper..."); + LOG(DEBUG_ANY, "[STEPPERS]: ALT Microsteps : %d", ALT_MICROSTEPPING); + LOG(DEBUG_ANY, "[STEPPERS]: ALT Stepper SPR : %d", ALT__STEPPER_SPR); + LOG(DEBUG_ANY, "[STEPPERS]: ALT Circumference : %f", ALT_CIRCUMFERENCE); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/rev : %f", ALTITUDE_STEPS_PER_REV); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/deg : %f", _stepsPerALTDegree); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); mount.configureALTStepper(ALTmotorPin1, ALTmotorPin2, ALT_STEPPER_SPEED, ALT_STEPPER_ACCELERATION); #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART LOG(DEBUG_ANY, "[STEPPERS]: Configure ALT driver..."); diff --git a/src/testmenu.cpp b/src/testmenu.cpp index 6620f38c..0dcabb51 100644 --- a/src/testmenu.cpp +++ b/src/testmenu.cpp @@ -261,9 +261,13 @@ void TestMenu::listHardware() const int index = 0; Serial.print(F(" Mount: ")); #ifdef OAM - Serial.println(F("OpenAstroMount (OAM)")); + Serial.println(F("OpenAstroMount (OAM)")); #else - Serial.println(F("OpenAstroTracker (OAT)")); + #ifdef OAE + Serial.println(F("OpenAstroExplorer (OAE)")); + #else + Serial.println(F("OpenAstroTracker (OAT)")); + #endif #endif while (p->length() > 0) @@ -529,7 +533,11 @@ void TestMenu::display() const #ifdef OAM Serial.println(F("*** OpenAstroMount (OAM) Test Menu ***")); #else - Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); + #ifdef OAE + Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); + #else + Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); + #endif #endif Serial.print(F("************* ")); Serial.print(freeMemory()); diff --git a/src/testmenudef.hpp b/src/testmenudef.hpp index eb959707..cbf18526 100644 --- a/src/testmenudef.hpp +++ b/src/testmenudef.hpp @@ -68,5 +68,5 @@ TestMenuItem menuItems[] = { TestMenuItem(MENU_FACTORY_RESET), }; -TestMenu mainTestMenu(0, "OAT/OAM Testing menu", "", menuItems, sizeof(menuItems) / sizeof(menuItems[0])); +TestMenu mainTestMenu(0, "OAT/OAM/OAE Testing menu", "", menuItems, sizeof(menuItems) / sizeof(menuItems[0])); #endif \ No newline at end of file From e8ab597243cb84b67baa4a95dc83ffd825265734 Mon Sep 17 00:00:00 2001 From: Lutz Kretzschmar Date: Sat, 12 Jul 2025 23:50:05 -0700 Subject: [PATCH 04/24] WIP --- Configuration_adv.hpp | 2 +- src/MeadeCommandProcessor.cpp | 2 +- src/Mount.cpp | 3 --- src/Mount.hpp | 2 +- src/b_setup.hpp | 4 +--- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index f691e2f6..e3abee7f 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -390,7 +390,7 @@ #define ALT_MICROSTEPPING 4 #endif #ifndef ALT_STEPPER_SPR - #define ALT_STEPPER_SPR 400 // NEMA 0.9° = 400 | NEMA 1.8° = 200 + #define ALT_STEPPER_SPR (400.0) // NEMA 0.9° = 400 | NEMA 1.8° = 200 #endif #ifndef ALT_STEPPER_SPEED #define ALT_STEPPER_SPEED 2000 diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp index 84794202..7b5c848a 100644 --- a/src/MeadeCommandProcessor.cpp +++ b/src/MeadeCommandProcessor.cpp @@ -501,7 +501,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp // Information: // This starts moving one of the steppers by the given amount of steps and returns immediately. Steps can be positive or negative. // Parameters: -// "x" is the stepper to move (r for RA, d for DEC, f for FOC, z for AZ, t for ALT) +// "x" is the stepper to move (r for RA, d for DEC, f for FOC, z for AZ, l for ALT) // "nnnn" is the number of steps // Returns: // "1" if successfully scheduled, else "0" diff --git a/src/Mount.cpp b/src/Mount.cpp index 132693bd..2bb8d946 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -78,9 +78,6 @@ Mount::Mount(LcdMenu *lcdMenu) { _commandReceived = 0; -#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - _loops = 0; -#endif _lcdMenu = lcdMenu; initializeVariables(); } diff --git a/src/Mount.hpp b/src/Mount.hpp index b84a73c8..fc897eec 100644 --- a/src/Mount.hpp +++ b/src/Mount.hpp @@ -406,7 +406,7 @@ class Mount void setupInfoDisplay(); void updateInfoDisplay(); InfoDisplayRender *getInfoDisplay(); - long _loops; + long _lastInfoUpdate = 0; // Last time the info display was updated #endif // Called by Meade processor every time a command is received. diff --git a/src/b_setup.hpp b/src/b_setup.hpp index f3c7f2c6..422d85ca 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -437,7 +437,6 @@ void setup() LOG(DEBUG_ANY, "[STEPPERS]: AZ Stepper SPR : %d", AZ_STEPPER_SPR); LOG(DEBUG_ANY, "[STEPPERS]: AZ Circumference : %f", AZ_CIRCUMFERENCE); LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/rev : %f", AZIMUTH_STEPS_PER_REV); - LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/deg : %f", _stepsPerAZDegree); LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/minute : %f", AZIMUTH_STEPS_PER_ARC_MINUTE); mount.configureAZStepper(AZmotorPin1, AZmotorPin2, AZ_STEPPER_SPEED, AZ_STEPPER_ACCELERATION); #if AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART @@ -452,10 +451,9 @@ void setup() #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) LOG(DEBUG_ANY, "[STEPPERS]: Configure Alt stepper..."); LOG(DEBUG_ANY, "[STEPPERS]: ALT Microsteps : %d", ALT_MICROSTEPPING); - LOG(DEBUG_ANY, "[STEPPERS]: ALT Stepper SPR : %d", ALT__STEPPER_SPR); + LOG(DEBUG_ANY, "[STEPPERS]: ALT Stepper SPR : %d", ALT_STEPPER_SPR); LOG(DEBUG_ANY, "[STEPPERS]: ALT Circumference : %f", ALT_CIRCUMFERENCE); LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/rev : %f", ALTITUDE_STEPS_PER_REV); - LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/deg : %f", _stepsPerALTDegree); LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); mount.configureALTStepper(ALTmotorPin1, ALTmotorPin2, ALT_STEPPER_SPEED, ALT_STEPPER_ACCELERATION); #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART From 4c9f93892b170811a22e4551e9d0e3483ea318da Mon Sep 17 00:00:00 2001 From: Lutz Date: Fri, 1 Aug 2025 23:38:50 -0700 Subject: [PATCH 05/24] V1.13.17 - Updates - Store AZ/ALT steps per degree and allow them to be set from Meade # Conflicts: # src/b_setup.hpp --- Changelog.md | 5 ++- Version.h | 2 +- src/EPROMStore.cpp | 80 +++++++++++++++++++++++++++++++++++ src/EPROMStore.hpp | 26 ++++++++++-- src/MeadeCommandProcessor.cpp | 56 +++++++++++++++++++++++- src/Mount.cpp | 47 +++++++++++++++++++- src/Mount.hpp | 4 +- src/b_setup.hpp | 2 + 8 files changed, 211 insertions(+), 11 deletions(-) diff --git a/Changelog.md b/Changelog.md index 97924f34..2cda9f2a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ +**V1.13.17 - Updates** +- Store AZ/ALT steps per degree and allow them to be set from Meade + **V1.13.15 - Updates** -- Changes necessary for OAE, add OAE baord +- Changes necessary for OAE, add OAE board - Check `INFO_DISPLAY_TYPE` builds in CI - Fix `INFO_DISPLAY_TYPE_I2C_SSD1306_128x64` for esp32 builds diff --git a/Version.h b/Version.h index e069b894..9c9e2e2b 100644 --- a/Version.h +++ b/Version.h @@ -3,4 +3,4 @@ // Also, numbers are interpreted as simple numbers. _ __ _ // So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/ -#define VERSION "V1.13.16" +#define VERSION "V1.13.17" diff --git a/src/EPROMStore.cpp b/src/EPROMStore.cpp index 97b92e90..bb20c8e0 100644 --- a/src/EPROMStore.cpp +++ b/src/EPROMStore.cpp @@ -141,6 +141,8 @@ void EEPROMStore::displayContents() LOG(DEBUG_INFO, "[EEPROM]: Stored RA Homing Offset: %l", getRAHomingOffset()); LOG(DEBUG_INFO, "[EEPROM]: Stored AZ Position: %l", getAZPosition()); LOG(DEBUG_INFO, "[EEPROM]: Stored ALT Position: %l", getALTPosition()); + LOG(DEBUG_INFO, "[EEPROM]: Stored AZ Steps per Degree: %f", getAZStepsPerDegree()); + LOG(DEBUG_INFO, "[EEPROM]: Stored ALT Steps per Degree: %f", getALTStepsPerDegree()); LOG(DEBUG_INFO, "[EEPROM]: Stored DEC Homing Offset : %l", getDECHomingOffset()); LOG(DEBUG_INFO, "[EEPROM]: Stored DEC Lower Limit: %l", getDECLowerLimit()); LOG(DEBUG_INFO, "[EEPROM]: Stored DEC Upper Limit: %l", getDECUpperLimit()); @@ -463,6 +465,84 @@ void EEPROMStore::storeDECStepsPerDegree(float decStepsPerDegree) commit(); // Complete the transaction } +// Return the AZ steps per degree (actually microsteps per degree). +// If it is not present then the default uncalibrated AZ_STEPS_PER_DEGREE value is returned. +float EEPROMStore::getAZStepsPerDegree() +{ + #if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE + float azStepsPerDegree(AZIMUTH_STEPS_PER_REV / 360); // Default value + #else + float azStepsPerDegree(1); // Default value + #endif + + if (isPresentExtended(AZ_NORM_STEPS_MARKER_FLAG)) + { + // Latest version stores 100x steps/deg for 256 MS + const float factor = SteppingStorageNormalized / AZ_MICROSTEPPING; + azStepsPerDegree = readInt32(AZ_NORM_STEPS_DEGREE_ADDR) / factor; + LOG(DEBUG_EEPROM, "[EEPROM]: AZ Normed Marker Present! AZ steps/deg is %f", azStepsPerDegree); + } + else + { + LOG(DEBUG_EEPROM, "[EEPROM]: No stored value for AZ steps"); + } + + return azStepsPerDegree; // microsteps per degree +} + +// Store the AZ steps per degree (actually microsteps per degree). +void EEPROMStore::storeAZStepsPerDegree(float azStepsPerDegree) +{ + // Store steps as 100x steps/deg at 256 MS. + const float factor = SteppingStorageNormalized / AZ_MICROSTEPPING; + int32_t val = azStepsPerDegree * factor; + LOG(DEBUG_EEPROM, "[EEPROM]: Storing AZ steps to %l (%f)", val, azStepsPerDegree); + + updateInt32(AZ_NORM_STEPS_DEGREE_ADDR, val); + updateFlagsExtended(AZ_NORM_STEPS_MARKER_FLAG); + commit(); // Complete the transaction +} + + +// Return the ALT steps per degree (actually microsteps per degree). +// If it is not present then the default uncalibrated ALT_STEPS_PER_DEGREE value is returned. +float EEPROMStore::getALTStepsPerDegree() +{ + #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + float azStepsPerDegree(ALTITUDE_STEPS_PER_REV / 360); // Default value + #else + float azStepsPerDegree(1); // Default value + #endif + + if (isPresentExtended(ALT_NORM_STEPS_MARKER_FLAG)) + { + // Latest version stores 100x steps/deg for 256 MS + const float factor = SteppingStorageNormalized / ALT_MICROSTEPPING; + azStepsPerDegree = readInt32(ALT_NORM_STEPS_DEGREE_ADDR) / factor; + LOG(DEBUG_EEPROM, "[EEPROM]: ALT Normed Marker Present! ALT steps/deg is %f", azStepsPerDegree); + } + else + { + LOG(DEBUG_EEPROM, "[EEPROM]: No stored value for ALT steps"); + } + + return azStepsPerDegree; // microsteps per degree +} + +// Store the ALT steps per degree (actually microsteps per degree). +void EEPROMStore::storeALTStepsPerDegree(float azStepsPerDegree) +{ + // Store steps as 100x steps/deg at 256 MS. + const float factor = SteppingStorageNormalized / ALT_MICROSTEPPING; + int32_t val = azStepsPerDegree * factor; + LOG(DEBUG_EEPROM, "[EEPROM]: Storing ALT steps to %l (%f)", val, azStepsPerDegree); + + updateInt32(ALT_NORM_STEPS_DEGREE_ADDR, val); + updateFlagsExtended(ALT_NORM_STEPS_MARKER_FLAG); + commit(); // Complete the transaction +} + + int16_t EEPROMStore::getLastFlashedVersion() { if (isPresentExtended(LAST_FLASHED_MARKER_FLAG)) diff --git a/src/EPROMStore.hpp b/src/EPROMStore.hpp index dd943350..506e987c 100644 --- a/src/EPROMStore.hpp +++ b/src/EPROMStore.hpp @@ -29,6 +29,12 @@ class EEPROMStore static float getDECStepsPerDegree(); static void storeDECStepsPerDegree(float decStepsPerDegree); + static float getAZStepsPerDegree(); + static void storeAZStepsPerDegree(float azStepsPerDegree); + + static float getALTStepsPerDegree(); + static void storeALTStepsPerDegree(float altStepsPerDegree); + static float getSpeedFactor(); static void storeSpeedFactor(float speed); @@ -91,13 +97,15 @@ class EEPROMStore // If Location 5 is 0xCF, then an extended 16-bit flag is stored in 21/22 and // indicates the additional fields that have been stored: 0000 0000 0000 0000 // ^^^^ ^^^^ ^^^^ ^^^^ - // || |||| |||| + // |||| |||| |||| + // ALT Steps/deg, normalized to 256MS (70-73) -------------+||| |||| |||| + // AZ Steps/deg, normalized to 256MS (66-69) --------------+|| |||| |||| // ALT position (62-65) ---------------+| |||| |||| // AZ Position (58-61) ----------------+ |||| |||| // Last flashed version (56-57) ------------------+||| |||| // DEC Homing Offet (52-55) -------------------+|| |||| - // DEC Steps/deg, normalized to 256MS (48-51) -------------------+| |||| - // RA Steps/deg, normalized to 256MS (44-47) --------------------+ |||| + // DEC Steps/deg, normalized to 256MS (48-51) --------------------+| |||| + // RA Steps/deg, normalized to 256MS (44-47) ---------------------+ |||| // RA Homing Offet (40-43) -----------------------+||| // UTC Offset (39) ------------------------+|| // DEC lower (31-34) and upper (35-38) limits -------------------------+| @@ -137,6 +145,8 @@ class EEPROMStore LAST_FLASHED_MARKER_FLAG = 0x0080, AZ_POSITION_MARKER_FLAG = 0x0100, ALT_POSITION_MARKER_FLAG = 0x0200, + AZ_NORM_STEPS_MARKER_FLAG = 0x0400, + ALT_NORM_STEPS_MARKER_FLAG = 0x0800, }; // These are the offsets to each item stored in the EEPROM @@ -209,7 +219,15 @@ class EEPROMStore _ALT_POSITION_ADDR_1, _ALT_POSITION_ADDR_2, _ALT_POSITION_ADDR_3, - STORE_SIZE = 66 + AZ_NORM_STEPS_DEGREE_ADDR = 66, + _AZ_NORM_STEPS_DEGREE_ADDR_1, + _AZ_NORM_STEPS_DEGREE_ADDR_2, + _AZ_NORM_STEPS_DEGREE_ADDR_3, // Int32 + ALT_NORM_STEPS_DEGREE_ADDR = 70, + _ALT_NORM_STEPS_DEGREE_ADDR_1, + _ALT_NORM_STEPS_DEGREE_ADDR_2, + _ALT_NORM_STEPS_DEGREE_ADDR_3, // Int32 + STORE_SIZE = 74 }; // Helper functions diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp index 7b5c848a..7bbe7eca 100644 --- a/src/MeadeCommandProcessor.cpp +++ b/src/MeadeCommandProcessor.cpp @@ -805,6 +805,24 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp // Returns: // "float#" // +// :XGZ# +// Description: +// Get AZ steps +// Information: +// Get the number of steps the AZ stepper motor needs to take to rotate AZ by one degree +// Returns: +// "float#" if AZ motor is present +// "0#" if AZ is not configured +// +// :XGA# +// Description: +// Get ALT steps +// Information: +// Get the number of steps the ALT stepper motor needs to take to rotate ALT by one degree +// Returns: +// "float#" if ALT motor is present +// "0#" if ALT is not configured +// // :XGDLx# // Description: // Get DEC limits @@ -841,7 +859,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp // "float#" // // :XGT# -// Description: +// Descrition: // Get Tracking speed // Information: // Get the absolute tracking speed of the mount. @@ -991,6 +1009,26 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp // Returns: // nothing // +// :XSAn.n# +// Description: +// Set AZ steps +// Information: +// Set the number of steps the AZ stepper motor needs to take to rotate by one degree. +// Parameters: +// "n.n" is the number of steps (only one decimal point is supported, must be positive) +// Returns: +// nothing +// +// :XSLn.n# +// Description: +// Set ALT steps +// Information: +// Set the number of steps the ALT stepper motor needs to take to rotate by one degree. +// Parameters: +// "n.n" is the number of steps (only one decimal point is supported, must be positive) +// Returns: +// nothing +// // :XSDLUnnnnn# // Description: // Set DEC upper limit @@ -1818,6 +1856,14 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd) { return String(_mount->getBacklashCorrection()) + "#"; } + else if ((inCmd[1] == 'A') && (inCmd.length() == 2)) // :XGA# + { + return String(_mount->getStepsPerDegree(ALTITUDE_STEPS),1) + "#"; + } + else if ((inCmd[1] == 'Z') && (inCmd.length() == 2)) // :XGZ# + { + return String(_mount->getStepsPerDegree(AZIMUTH_STEPS),1) + "#"; + } else if ((inCmd[1] == 'A') && (inCmd.length() > 2) && (inCmd[2] == 'H')) // :XGAH# { return _mount->getAutoHomingStates() + "#"; @@ -1911,6 +1957,14 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd) { _mount->setStepsPerDegree(RA_STEPS, inCmd.substring(2).toFloat()); } + else if (inCmd[1] == 'A') // :XSA# + { + _mount->setStepsPerDegree(AZIMUTH_STEPS, inCmd.substring(2).toFloat()); + } + else if (inCmd[1] == 'L') // :XSL# + { + _mount->setStepsPerDegree(ALTITUDE_STEPS, inCmd.substring(2).toFloat()); + } else if (inCmd[1] == 'D') // :XSD { if ((inCmd.length() > 2) && (inCmd[2] == 'L')) // :XSDL diff --git a/src/Mount.cpp b/src/Mount.cpp index 2bb8d946..298656e9 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -190,6 +190,15 @@ void Mount::readPersistentData() _stepsPerDECDegree = EEPROMStore::getDECStepsPerDegree(); LOG(DEBUG_INFO, "[MOUNT]: EEPROM: DEC steps/deg is %f", _stepsPerDECDegree); + #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + _stepsPerAZDegree = EEPROMStore::getAZStepsPerDegree(); + LOG(DEBUG_INFO, "[MOUNT]: EEPROM: AZ steps/deg is %f", _stepsPerAZDegree); + #endif + + #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + _stepsPerALTDegree = EEPROMStore::getALTStepsPerDegree(); + LOG(DEBUG_INFO, "[MOUNT]: EEPROM: ALT steps/deg is %f", _stepsPerALTDegree); + #endif float speed = EEPROMStore::getSpeedFactor(); LOG(DEBUG_INFO, "[MOUNT]: EEPROM: Speed factor is %f", speed); setSpeedCalibration(speed, false); @@ -986,6 +995,22 @@ float Mount::getStepsPerDegree(StepperAxis which) { return _stepsPerDECDegree; // u-steps/degree } + if (which == AZIMUTH_STEPS) + { + #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + return _stepsPerAZDegree; // u-steps/degree + #else + return 1; + #endif + } + if (which == ALTITUDE_STEPS) + { + #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + return _stepsPerALTDegree; // u-steps/degree + #else + return 1; + #endif + } return 0; } @@ -1009,6 +1034,20 @@ void Mount::setStepsPerDegree(StepperAxis which, float steps) EEPROMStore::storeRAStepsPerDegree(_stepsPerRADegree); setSpeedCalibration(_trackingSpeedCalibration, false); } + #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + else if (which == AZIMUTH_STEPS) + { + _stepsPerAZDegree = steps; + EEPROMStore::storeAZStepsPerDegree(_stepsPerAZDegree); + } + #endif + #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + else if (which == ALTITUDE_STEPS) + { + _stepsPerALTDegree = steps; + EEPROMStore::storeALTStepsPerDegree(_stepsPerALTDegree); + } + #endif } ///////////////////////////////// @@ -2983,8 +3022,12 @@ void Mount::loop() // One of the motors was running last time through the loop, but not anymore, so shutdown the outputs. disableAzAltMotors(); _azAltWasRunning = false; - EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); - EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); + #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); + #endif + #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); + #endif } oneIsRunning = false; diff --git a/src/Mount.hpp b/src/Mount.hpp index fc897eec..1d170f9d 100644 --- a/src/Mount.hpp +++ b/src/Mount.hpp @@ -607,7 +607,7 @@ class Mount #else AccelStepper *_stepperAZ; #endif - const long _stepsPerAZDegree; // u-steps/degree (from CTOR) + float _stepsPerAZDegree; // u-steps/degree (from CTOR) #if AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART TMC2209Stepper *_driverAZ; #endif @@ -618,7 +618,7 @@ class Mount #else AccelStepper *_stepperALT; #endif - const long _stepsPerALTDegree; // u-steps/degree (from CTOR) + float _stepsPerALTDegree; // u-steps/degree (from CTOR) #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART TMC2209Stepper *_driverALT; #endif diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 422d85ca..31eec150 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -437,6 +437,7 @@ void setup() LOG(DEBUG_ANY, "[STEPPERS]: AZ Stepper SPR : %d", AZ_STEPPER_SPR); LOG(DEBUG_ANY, "[STEPPERS]: AZ Circumference : %f", AZ_CIRCUMFERENCE); LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/rev : %f", AZIMUTH_STEPS_PER_REV); + LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/deg : %f", mount.getStepsPerDegree(AZIMUTH_STEPS)); LOG(DEBUG_ANY, "[STEPPERS]: AZ steps/minute : %f", AZIMUTH_STEPS_PER_ARC_MINUTE); mount.configureAZStepper(AZmotorPin1, AZmotorPin2, AZ_STEPPER_SPEED, AZ_STEPPER_ACCELERATION); #if AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART @@ -454,6 +455,7 @@ void setup() LOG(DEBUG_ANY, "[STEPPERS]: ALT Stepper SPR : %d", ALT_STEPPER_SPR); LOG(DEBUG_ANY, "[STEPPERS]: ALT Circumference : %f", ALT_CIRCUMFERENCE); LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/rev : %f", ALTITUDE_STEPS_PER_REV); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/deg : %f", mount.getStepsPerDegree(ALTITUDE_STEPS)); LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); mount.configureALTStepper(ALTmotorPin1, ALTmotorPin2, ALT_STEPPER_SPEED, ALT_STEPPER_ACCELERATION); #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART From 58a1f4039d6f82d82b870e8dc99889193f6b331d Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Wed, 6 Aug 2025 13:14:57 +0200 Subject: [PATCH 06/24] WIP - fix values and calculations for OAE ALT/AZ motion --- Configuration_adv.hpp | 21 ++++++++++----------- boards/ESP32_ESP32DEV/pins_OAE_V1.hpp | 1 - src/b_setup.hpp | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index e3abee7f..5ddfb83b 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -337,23 +337,25 @@ #ifdef OAE // Roughly from the joint to the rod placement is 70mm #define AZ_CIRCUMFERENCE 70.0f * 2 * PI + #ifndef AZ_ROD_PITCH + #define AZ_ROD_PITCH 0.5 + #endif + #define AZIMUTH_STEPS_PER_REV + \ + (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev #else #define AZ_CIRCUMFERENCE 2538.4f #endif #endif - #ifdef OAE - #ifndef AZ_WORMGEAR_RATIO - #define AZ_WORMGEAR_RATIO (40.0f) - #endif - #else + + #ifndef OAE #define AZ_WORMGEAR_RATIO 1.0f #endif #ifndef AZIMUTH_STEPS_PER_REV #define AZIMUTH_STEPS_PER_REV \ (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / (AZ_PULLEY_TEETH * GT2_BELT_PITCH)) * AZ_STEPPER_SPR \ - * AZ_MICROSTEPPING * AZ_WORMGEAR_RATIO) // Actually u-steps/rev + * AZ_MICROSTEPPING) // Actually u-steps/rev #endif #ifndef AZIMUTH_STEPS_PER_ARC_MINUTE @@ -420,12 +422,9 @@ #define ALT_ROD_PITCH 1.25 // mm/rev #endif // the Circumference of the ALT rotation. Roughly 146mm radius. - #define ALT_CIRCUMFERENCE 146.0f * 2 * PI - #ifndef ALT_WORMGEAR_RATIO - #define ALT_WORMGEAR_RATIO (40.0f) - #endif + #define ALT_CIRCUMFERENCE 128.0f * 2 * PI #define ALTITUDE_STEPS_PER_REV + \ - (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING * ALT_WORMGEAR_RATIO) // Actually u-steps/rev + (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev #else // the Circumference of the AZ rotation. 770mm dia. #define ALT_CIRCUMFERENCE 2419.0f diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp index 60d962f8..1bdb4b9f 100644 --- a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp +++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp @@ -105,7 +105,6 @@ // Defines for OAE /////////////////////// -#define OAM //enable GEM Motion #ifndef RA_WHEEL_CIRCUMFERENCE #define RA_WHEEL_CIRCUMFERENCE 704.97f diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 31eec150..2d9e2696 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -180,7 +180,7 @@ void setup() #endif #ifdef RA_SERIAL_PORT - #if defined(BOARD_OAE_V1) + #ifdef OAE RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); #else RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver @@ -207,7 +207,7 @@ void setup() pinMode(DEC_DIAG_PIN, INPUT); #endif #ifdef DEC_SERIAL_PORT - #if defined(BOARD_OAE_V1) + #ifdef OAE DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); #else DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver From 99ff3ad26e0056f3f26ef1490eb9b50778d8acae Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Tue, 4 Nov 2025 14:28:27 +0100 Subject: [PATCH 07/24] adjust TMC driver current --- Configuration_adv.hpp | 4 ++-- src/Mount.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index 5ddfb83b..09ccb3e6 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -336,7 +336,7 @@ #ifndef AZ_CIRCUMFERENCE #ifdef OAE // Roughly from the joint to the rod placement is 70mm - #define AZ_CIRCUMFERENCE 70.0f * 2 * PI + #define AZ_CIRCUMFERENCE 56.0f * 2 * PI #ifndef AZ_ROD_PITCH #define AZ_ROD_PITCH 0.5 #endif @@ -422,7 +422,7 @@ #define ALT_ROD_PITCH 1.25 // mm/rev #endif // the Circumference of the ALT rotation. Roughly 146mm radius. - #define ALT_CIRCUMFERENCE 128.0f * 2 * PI + #define ALT_CIRCUMFERENCE 130.0f * 2 * PI #define ALTITUDE_STEPS_PER_REV + \ (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev #else diff --git a/src/Mount.cpp b/src/Mount.cpp index 298656e9..9ceca386 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -492,6 +492,8 @@ void Mount::configureRAdriver(Stream *serial, float rsense, byte driveraddress, #endif LOG(DEBUG_STEPPERS, "[MOUNT]: Requested RA motor rms_current: %d mA", rmscurrent); _driverRA->rms_current(rmscurrent, 1.0f); //holdMultiplier = 1 to set ihold = irun + _driverRA->pdn_disable(1); + _driverRA->ihold(31); _driverRA->toff(1); _driverRA->en_spreadCycle(RA_UART_STEALTH_MODE == 0); _driverRA->blank_time(24); @@ -575,6 +577,10 @@ void Mount::configureDECdriver(Stream *serial, float rsense, byte driveraddress, #endif LOG(DEBUG_STEPPERS, "[MOUNT]: Requested DEC motor rms_current: %d mA", rmscurrent); _driverDEC->rms_current(rmscurrent, 1.0f); //holdMultiplier = 1 to set ihold = irun + _driverDEC->pdn_disable(1); + _driverDEC->ihold(31); + _driverDEC->iholddelay(15); + _driverDEC->TPOWERDOWN(255); _driverDEC->toff(1); _driverDEC->en_spreadCycle(DEC_UART_STEALTH_MODE == 0); _driverDEC->blank_time(24); From 2bc86dfc229582ef3c64c7e43ee418bc35c1b92a Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Tue, 4 Nov 2025 14:30:08 +0100 Subject: [PATCH 08/24] Version bump --- Changelog.md | 3 +++ Version.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 2cda9f2a..e787e1e4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,6 @@ +**V1.13.17 - Updates** +- Final changes for OAE + **V1.13.17 - Updates** - Store AZ/ALT steps per degree and allow them to be set from Meade diff --git a/Version.h b/Version.h index 9c9e2e2b..3fa9e59d 100644 --- a/Version.h +++ b/Version.h @@ -3,4 +3,4 @@ // Also, numbers are interpreted as simple numbers. _ __ _ // So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/ -#define VERSION "V1.13.17" +#define VERSION "V1.13.18" From c2a5f82cc721ecf8a829efa2bc96bc0e9a9a15b1 Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Tue, 4 Nov 2025 14:35:56 +0100 Subject: [PATCH 09/24] Version bump --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index e787e1e4..fbc44c3f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,4 @@ -**V1.13.17 - Updates** +**V1.13.18 - Updates** - Final changes for OAE **V1.13.17 - Updates** From 3ebf8c715176e3c5db918a23073edd0fb2804efb Mon Sep 17 00:00:00 2001 From: Fabian Uehleke Date: Tue, 4 Nov 2025 15:14:05 +0100 Subject: [PATCH 10/24] apply clang-format --- ConfigurationValidation.hpp | 5 +- Configuration_adv.hpp | 21 +- Constants.hpp | 2 +- boards/ESP32_ESP32DEV/pins_OAE_V1.hpp | 9 +- clang-format-diff.patch | 448 ++++++++++++++++++++++++++ src/EPROMStore.cpp | 14 +- src/MeadeCommandProcessor.cpp | 4 +- src/Mount.cpp | 60 ++-- src/Mount.hpp | 2 +- src/b_setup.hpp | 12 +- src/testmenu.cpp | 10 +- 11 files changed, 514 insertions(+), 73 deletions(-) create mode 100644 clang-format-diff.patch diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp index 74667a10..82ed67ed 100644 --- a/ConfigurationValidation.hpp +++ b/ConfigurationValidation.hpp @@ -90,8 +90,7 @@ #endif #endif #elif defined(BOARD_OAE_V1) - // Valid - +// Valid #else #error Configuration does not support AZ. Use at own risk. @@ -114,7 +113,7 @@ #endif #elif defined(BOARD_OAE_V1) - // Valid +// Valid #else #warning Configuration does not support ALT. Use at own risk. diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index 09ccb3e6..cd168333 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -340,13 +340,12 @@ #ifndef AZ_ROD_PITCH #define AZ_ROD_PITCH 0.5 #endif - #define AZIMUTH_STEPS_PER_REV + \ - (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev + #define AZIMUTH_STEPS_PER_REV \ + +(AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev #else #define AZ_CIRCUMFERENCE 2538.4f #endif #endif - #ifndef OAE #define AZ_WORMGEAR_RATIO 1.0f @@ -357,7 +356,7 @@ (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / (AZ_PULLEY_TEETH * GT2_BELT_PITCH)) * AZ_STEPPER_SPR \ * AZ_MICROSTEPPING) // Actually u-steps/rev #endif - + #ifndef AZIMUTH_STEPS_PER_ARC_MINUTE #define AZIMUTH_STEPS_PER_ARC_MINUTE (AZIMUTH_STEPS_PER_REV / (360 * 60.0f)) // Used to determine move distance in steps #endif @@ -416,15 +415,16 @@ #define ALTITUDE_STEPS_PER_REV \ (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev - #else + #else #ifdef OAE #ifndef ALT_ROD_PITCH #define ALT_ROD_PITCH 1.25 // mm/rev #endif // the Circumference of the ALT rotation. Roughly 146mm radius. #define ALT_CIRCUMFERENCE 130.0f * 2 * PI - #define ALTITUDE_STEPS_PER_REV + \ - (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev + #define ALTITUDE_STEPS_PER_REV \ + +(ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR \ + * ALT_MICROSTEPPING) // Actually u-steps/rev #else // the Circumference of the AZ rotation. 770mm dia. #define ALT_CIRCUMFERENCE 2419.0f @@ -436,9 +436,9 @@ #define ALT_WORMGEAR_RATIO (40.0f) #endif #ifndef ALTITUDE_STEPS_PER_REV - #define ALTITUDE_STEPS_PER_REV \ - (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR * ALT_MICROSTEPPING \ - * ALT_WORMGEAR_RATIO) // Actually u-steps/rev + #define ALTITUDE_STEPS_PER_REV \ + (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR \ + * ALT_MICROSTEPPING * ALT_WORMGEAR_RATIO) // Actually u-steps/rev #endif #endif #endif @@ -649,7 +649,6 @@ // //////// //////////////////////////////////////////// - // Focuser #if (FOCUS_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) #if defined(ESP32) diff --git a/Constants.hpp b/Constants.hpp index 17c00429..f4a9ddd0 100644 --- a/Constants.hpp +++ b/Constants.hpp @@ -18,7 +18,7 @@ // ESP32 based boards #define BOARD_ESP32_ESP32DEV 1001 -#define BOARD_OAE_V1 1002 +#define BOARD_OAE_V1 1002 /** * Supported keypad/display types. Use one of these values for DISPLAY_TYPE configuration matching your used display and keypad. diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp index 1bdb4b9f..00d3db68 100644 --- a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp +++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp @@ -83,13 +83,13 @@ // DISPLAY_TYPE_LCD_JOY_I2C_SSD1306 requires 3 analog inputs in Arduino pin numbering #ifndef LCD_KEY_SENSE_X_PIN - //#define LCD_KEY_SENSE_X_PIN 34 +//#define LCD_KEY_SENSE_X_PIN 34 #endif #ifndef LCD_KEY_SENSE_Y_PIN - //#define LCD_KEY_SENSE_Y_PIN 39 +//#define LCD_KEY_SENSE_Y_PIN 39 #endif #ifndef LCD_KEY_SENSE_PUSH_PIN - //#define LCD_KEY_SENSE_PUSH_PIN 36 +//#define LCD_KEY_SENSE_PUSH_PIN 36 #endif //Serial port for external debugging @@ -103,7 +103,6 @@ #endif #endif - // Defines for OAE /////////////////////// #ifndef RA_WHEEL_CIRCUMFERENCE @@ -125,7 +124,7 @@ #define DEC_WHEEL_CIRCUMFERENCE 1.0f #endif #ifndef RA_STEPPER_SPR - #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper + #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper #endif #ifndef DEC_STEPPER_SPR #define DEC_STEPPER_SPR (200 * 50 * 4.5f) // change to (200 * 9) for 1.8° stepper diff --git a/clang-format-diff.patch b/clang-format-diff.patch new file mode 100644 index 00000000..b71ab8e0 --- /dev/null +++ b/clang-format-diff.patch @@ -0,0 +1,448 @@ +diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp +index 74667a1..82ed67e 100644 +--- a/ConfigurationValidation.hpp ++++ b/ConfigurationValidation.hpp +@@ -90,8 +90,7 @@ + #endif + #endif + #elif defined(BOARD_OAE_V1) +- // Valid +- ++// Valid + + #else + #error Configuration does not support AZ. Use at own risk. +@@ -114,7 +113,7 @@ + #endif + + #elif defined(BOARD_OAE_V1) +- // Valid ++// Valid + + #else + #warning Configuration does not support ALT. Use at own risk. +diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp +index 09ccb3e..cd16833 100644 +--- a/Configuration_adv.hpp ++++ b/Configuration_adv.hpp +@@ -340,13 +340,12 @@ + #ifndef AZ_ROD_PITCH + #define AZ_ROD_PITCH 0.5 + #endif +- #define AZIMUTH_STEPS_PER_REV + \ +- (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev ++ #define AZIMUTH_STEPS_PER_REV \ ++ +(AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev + #else + #define AZ_CIRCUMFERENCE 2538.4f + #endif + #endif +- + + #ifndef OAE + #define AZ_WORMGEAR_RATIO 1.0f +@@ -357,7 +356,7 @@ + (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / (AZ_PULLEY_TEETH * GT2_BELT_PITCH)) * AZ_STEPPER_SPR \ + * AZ_MICROSTEPPING) // Actually u-steps/rev + #endif +- ++ + #ifndef AZIMUTH_STEPS_PER_ARC_MINUTE + #define AZIMUTH_STEPS_PER_ARC_MINUTE (AZIMUTH_STEPS_PER_REV / (360 * 60.0f)) // Used to determine move distance in steps + #endif +@@ -416,15 +415,16 @@ + #define ALTITUDE_STEPS_PER_REV \ + (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev + +- #else ++ #else + #ifdef OAE + #ifndef ALT_ROD_PITCH + #define ALT_ROD_PITCH 1.25 // mm/rev + #endif + // the Circumference of the ALT rotation. Roughly 146mm radius. + #define ALT_CIRCUMFERENCE 130.0f * 2 * PI +- #define ALTITUDE_STEPS_PER_REV + \ +- (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev ++ #define ALTITUDE_STEPS_PER_REV \ ++ +(ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR \ ++ * ALT_MICROSTEPPING) // Actually u-steps/rev + #else + // the Circumference of the AZ rotation. 770mm dia. + #define ALT_CIRCUMFERENCE 2419.0f +@@ -436,9 +436,9 @@ + #define ALT_WORMGEAR_RATIO (40.0f) + #endif + #ifndef ALTITUDE_STEPS_PER_REV +- #define ALTITUDE_STEPS_PER_REV \ +- (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR * ALT_MICROSTEPPING \ +- * ALT_WORMGEAR_RATIO) // Actually u-steps/rev ++ #define ALTITUDE_STEPS_PER_REV \ ++ (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR \ ++ * ALT_MICROSTEPPING * ALT_WORMGEAR_RATIO) // Actually u-steps/rev + #endif + #endif + #endif +@@ -649,7 +649,6 @@ + // //////// + //////////////////////////////////////////// + +- + // Focuser + #if (FOCUS_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) + #if defined(ESP32) +diff --git a/Constants.hpp b/Constants.hpp +index 17c0042..f4a9ddd 100644 +--- a/Constants.hpp ++++ b/Constants.hpp +@@ -18,7 +18,7 @@ + + // ESP32 based boards + #define BOARD_ESP32_ESP32DEV 1001 +-#define BOARD_OAE_V1 1002 ++#define BOARD_OAE_V1 1002 + + /** + * Supported keypad/display types. Use one of these values for DISPLAY_TYPE configuration matching your used display and keypad. +diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp +index 1bdb4b9..00d3db6 100644 +--- a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp ++++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp +@@ -83,13 +83,13 @@ + + // DISPLAY_TYPE_LCD_JOY_I2C_SSD1306 requires 3 analog inputs in Arduino pin numbering + #ifndef LCD_KEY_SENSE_X_PIN +- //#define LCD_KEY_SENSE_X_PIN 34 ++//#define LCD_KEY_SENSE_X_PIN 34 + #endif + #ifndef LCD_KEY_SENSE_Y_PIN +- //#define LCD_KEY_SENSE_Y_PIN 39 ++//#define LCD_KEY_SENSE_Y_PIN 39 + #endif + #ifndef LCD_KEY_SENSE_PUSH_PIN +- //#define LCD_KEY_SENSE_PUSH_PIN 36 ++//#define LCD_KEY_SENSE_PUSH_PIN 36 + #endif + + //Serial port for external debugging +@@ -103,7 +103,6 @@ + #endif + #endif + +- + // Defines for OAE /////////////////////// + + #ifndef RA_WHEEL_CIRCUMFERENCE +@@ -125,7 +124,7 @@ + #define DEC_WHEEL_CIRCUMFERENCE 1.0f + #endif + #ifndef RA_STEPPER_SPR +- #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper ++ #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper + #endif + #ifndef DEC_STEPPER_SPR + #define DEC_STEPPER_SPR (200 * 50 * 4.5f) // change to (200 * 9) for 1.8° stepper +diff --git a/src/EPROMStore.cpp b/src/EPROMStore.cpp +index bb20c8e..b82d7be 100644 +--- a/src/EPROMStore.cpp ++++ b/src/EPROMStore.cpp +@@ -469,11 +469,11 @@ void EEPROMStore::storeDECStepsPerDegree(float decStepsPerDegree) + // If it is not present then the default uncalibrated AZ_STEPS_PER_DEGREE value is returned. + float EEPROMStore::getAZStepsPerDegree() + { +- #if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE ++#if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE + float azStepsPerDegree(AZIMUTH_STEPS_PER_REV / 360); // Default value +- #else ++#else + float azStepsPerDegree(1); // Default value +- #endif ++#endif + + if (isPresentExtended(AZ_NORM_STEPS_MARKER_FLAG)) + { +@@ -503,16 +503,15 @@ void EEPROMStore::storeAZStepsPerDegree(float azStepsPerDegree) + commit(); // Complete the transaction + } + +- + // Return the ALT steps per degree (actually microsteps per degree). + // If it is not present then the default uncalibrated ALT_STEPS_PER_DEGREE value is returned. + float EEPROMStore::getALTStepsPerDegree() + { +- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + float azStepsPerDegree(ALTITUDE_STEPS_PER_REV / 360); // Default value +- #else ++#else + float azStepsPerDegree(1); // Default value +- #endif ++#endif + + if (isPresentExtended(ALT_NORM_STEPS_MARKER_FLAG)) + { +@@ -542,7 +541,6 @@ void EEPROMStore::storeALTStepsPerDegree(float azStepsPerDegree) + commit(); // Complete the transaction + } + +- + int16_t EEPROMStore::getLastFlashedVersion() + { + if (isPresentExtended(LAST_FLASHED_MARKER_FLAG)) +diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp +index 7bbe7ec..0788954 100644 +--- a/src/MeadeCommandProcessor.cpp ++++ b/src/MeadeCommandProcessor.cpp +@@ -1858,11 +1858,11 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd) + } + else if ((inCmd[1] == 'A') && (inCmd.length() == 2)) // :XGA# + { +- return String(_mount->getStepsPerDegree(ALTITUDE_STEPS),1) + "#"; ++ return String(_mount->getStepsPerDegree(ALTITUDE_STEPS), 1) + "#"; + } + else if ((inCmd[1] == 'Z') && (inCmd.length() == 2)) // :XGZ# + { +- return String(_mount->getStepsPerDegree(AZIMUTH_STEPS),1) + "#"; ++ return String(_mount->getStepsPerDegree(AZIMUTH_STEPS), 1) + "#"; + } + else if ((inCmd[1] == 'A') && (inCmd.length() > 2) && (inCmd[2] == 'H')) // :XGAH# + { +diff --git a/src/Mount.cpp b/src/Mount.cpp +index 9ceca38..bd2a94b 100644 +--- a/src/Mount.cpp ++++ b/src/Mount.cpp +@@ -78,7 +78,7 @@ Mount::Mount(LcdMenu *lcdMenu) + + { + _commandReceived = 0; +- _lcdMenu = lcdMenu; ++ _lcdMenu = lcdMenu; + initializeVariables(); + } + +@@ -190,15 +190,15 @@ void Mount::readPersistentData() + _stepsPerDECDegree = EEPROMStore::getDECStepsPerDegree(); + LOG(DEBUG_INFO, "[MOUNT]: EEPROM: DEC steps/deg is %f", _stepsPerDECDegree); + +- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + _stepsPerAZDegree = EEPROMStore::getAZStepsPerDegree(); + LOG(DEBUG_INFO, "[MOUNT]: EEPROM: AZ steps/deg is %f", _stepsPerAZDegree); +- #endif ++#endif + +- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + _stepsPerALTDegree = EEPROMStore::getALTStepsPerDegree(); + LOG(DEBUG_INFO, "[MOUNT]: EEPROM: ALT steps/deg is %f", _stepsPerALTDegree); +- #endif ++#endif + float speed = EEPROMStore::getSpeedFactor(); + LOG(DEBUG_INFO, "[MOUNT]: EEPROM: Speed factor is %f", speed); + setSpeedCalibration(speed, false); +@@ -1003,19 +1003,19 @@ float Mount::getStepsPerDegree(StepperAxis which) + } + if (which == AZIMUTH_STEPS) + { +- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + return _stepsPerAZDegree; // u-steps/degree +- #else ++#else + return 1; +- #endif ++#endif + } + if (which == ALTITUDE_STEPS) + { +- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + return _stepsPerALTDegree; // u-steps/degree +- #else ++#else + return 1; +- #endif ++#endif + } + + return 0; +@@ -1040,20 +1040,20 @@ void Mount::setStepsPerDegree(StepperAxis which, float steps) + EEPROMStore::storeRAStepsPerDegree(_stepsPerRADegree); + setSpeedCalibration(_trackingSpeedCalibration, false); + } +- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + else if (which == AZIMUTH_STEPS) + { + _stepsPerAZDegree = steps; + EEPROMStore::storeAZStepsPerDegree(_stepsPerAZDegree); + } +- #endif +- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) ++#endif ++#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + else if (which == ALTITUDE_STEPS) + { + _stepsPerALTDegree = steps; + EEPROMStore::storeALTStepsPerDegree(_stepsPerALTDegree); + } +- #endif ++#endif + } + + ///////////////////////////////// +@@ -1621,13 +1621,13 @@ void Mount::stopGuiding(bool ra, bool dec) + // Stop DEC guiding and wait for it to stop. + _stepperGUIDE->stop(); + +- #if !defined(ESP32BOARD) ++#if !defined(ESP32BOARD) + while (_stepperGUIDE->isRunning()) + { + _stepperGUIDE->run(); + _stepperTRK->runSpeed(); + } +- #endif ++#endif + + _mountStatus &= ~STATUS_GUIDE_PULSE_DEC; + } +@@ -2678,9 +2678,7 @@ void Mount::waitUntilStopped(byte direction) + // Block until all steppers are stopped + void Mount::waitUntilAllStopped() + { +- while (_stepperRA->isRunning() +- || _stepperDEC->isRunning() +- || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) ++ while (_stepperRA->isRunning() || _stepperDEC->isRunning() || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) + #if FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE + || _stepperFocus->isRunning() + #endif +@@ -3028,12 +3026,12 @@ void Mount::loop() + // One of the motors was running last time through the loop, but not anymore, so shutdown the outputs. + disableAzAltMotors(); + _azAltWasRunning = false; +- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) +- EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); +- #endif +- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) +- EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); +- #endif ++ #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) ++ EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); ++ #endif ++ #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) ++ EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); ++ #endif + } + + oneIsRunning = false; +@@ -3305,16 +3303,16 @@ void Mount::updateInfoDisplay() + { + #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) + // If we update this display too often while slewing, the serial port is unable to process commands fast enough. Which makes the driver +- // timeout, causing ASCOM errors. ++ // timeout, causing ASCOM errors. + // We will update at 30Hz when idle, 5Hz when slewing one axis and skip updates when slewing both. + int refreshRateHz = 30; +- long now = millis(); +- if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) ++ long now = millis(); ++ if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) + { + return; + } +- +- if (isSlewingRAorDEC()) ++ ++ if (isSlewingRAorDEC()) + { + refreshRateHz = 5; + } +diff --git a/src/Mount.hpp b/src/Mount.hpp +index 1d170f9..7cf00a7 100644 +--- a/src/Mount.hpp ++++ b/src/Mount.hpp +@@ -406,7 +406,7 @@ class Mount + void setupInfoDisplay(); + void updateInfoDisplay(); + InfoDisplayRender *getInfoDisplay(); +- long _lastInfoUpdate = 0; // Last time the info display was updated ++ long _lastInfoUpdate = 0; // Last time the info display was updated + #endif + + // Called by Meade processor every time a command is received. +diff --git a/src/b_setup.hpp b/src/b_setup.hpp +index 2d9e269..5ac294a 100644 +--- a/src/b_setup.hpp ++++ b/src/b_setup.hpp +@@ -181,9 +181,9 @@ void setup() + + #ifdef RA_SERIAL_PORT + #ifdef OAE +- RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); ++ RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); + #else +- RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver ++ RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + #endif + // + #endif +@@ -204,13 +204,13 @@ void setup() + #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART + // include TMC2209 UART pins + #if defined(DEC_DIAG_PIN) +- pinMode(DEC_DIAG_PIN, INPUT); ++ pinMode(DEC_DIAG_PIN, INPUT); + #endif + #ifdef DEC_SERIAL_PORT + #ifdef OAE +- DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); ++ DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); + #else +- DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver ++ DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + #endif + #endif + #endif +@@ -456,7 +456,7 @@ void setup() + LOG(DEBUG_ANY, "[STEPPERS]: ALT Circumference : %f", ALT_CIRCUMFERENCE); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/rev : %f", ALTITUDE_STEPS_PER_REV); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/deg : %f", mount.getStepsPerDegree(ALTITUDE_STEPS)); +- LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); ++ LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); + mount.configureALTStepper(ALTmotorPin1, ALTmotorPin2, ALT_STEPPER_SPEED, ALT_STEPPER_ACCELERATION); + #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART + LOG(DEBUG_ANY, "[STEPPERS]: Configure ALT driver..."); +diff --git a/src/testmenu.cpp b/src/testmenu.cpp +index 0dcabb5..b046bf4 100644 +--- a/src/testmenu.cpp ++++ b/src/testmenu.cpp +@@ -261,12 +261,12 @@ void TestMenu::listHardware() const + int index = 0; + Serial.print(F(" Mount: ")); + #ifdef OAM +- Serial.println(F("OpenAstroMount (OAM)")); ++ Serial.println(F("OpenAstroMount (OAM)")); + #else + #ifdef OAE +- Serial.println(F("OpenAstroExplorer (OAE)")); ++ Serial.println(F("OpenAstroExplorer (OAE)")); + #else +- Serial.println(F("OpenAstroTracker (OAT)")); ++ Serial.println(F("OpenAstroTracker (OAT)")); + #endif + #endif + +@@ -534,9 +534,9 @@ void TestMenu::display() const + Serial.println(F("*** OpenAstroMount (OAM) Test Menu ***")); + #else + #ifdef OAE +- Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); ++ Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); + #else +- Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); ++ Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); + #endif + #endif + Serial.print(F("************* ")); diff --git a/src/EPROMStore.cpp b/src/EPROMStore.cpp index bb20c8e0..b82d7be8 100644 --- a/src/EPROMStore.cpp +++ b/src/EPROMStore.cpp @@ -469,11 +469,11 @@ void EEPROMStore::storeDECStepsPerDegree(float decStepsPerDegree) // If it is not present then the default uncalibrated AZ_STEPS_PER_DEGREE value is returned. float EEPROMStore::getAZStepsPerDegree() { - #if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE +#if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE float azStepsPerDegree(AZIMUTH_STEPS_PER_REV / 360); // Default value - #else +#else float azStepsPerDegree(1); // Default value - #endif +#endif if (isPresentExtended(AZ_NORM_STEPS_MARKER_FLAG)) { @@ -503,16 +503,15 @@ void EEPROMStore::storeAZStepsPerDegree(float azStepsPerDegree) commit(); // Complete the transaction } - // Return the ALT steps per degree (actually microsteps per degree). // If it is not present then the default uncalibrated ALT_STEPS_PER_DEGREE value is returned. float EEPROMStore::getALTStepsPerDegree() { - #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) float azStepsPerDegree(ALTITUDE_STEPS_PER_REV / 360); // Default value - #else +#else float azStepsPerDegree(1); // Default value - #endif +#endif if (isPresentExtended(ALT_NORM_STEPS_MARKER_FLAG)) { @@ -542,7 +541,6 @@ void EEPROMStore::storeALTStepsPerDegree(float azStepsPerDegree) commit(); // Complete the transaction } - int16_t EEPROMStore::getLastFlashedVersion() { if (isPresentExtended(LAST_FLASHED_MARKER_FLAG)) diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp index 7bbe7eca..07889548 100644 --- a/src/MeadeCommandProcessor.cpp +++ b/src/MeadeCommandProcessor.cpp @@ -1858,11 +1858,11 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd) } else if ((inCmd[1] == 'A') && (inCmd.length() == 2)) // :XGA# { - return String(_mount->getStepsPerDegree(ALTITUDE_STEPS),1) + "#"; + return String(_mount->getStepsPerDegree(ALTITUDE_STEPS), 1) + "#"; } else if ((inCmd[1] == 'Z') && (inCmd.length() == 2)) // :XGZ# { - return String(_mount->getStepsPerDegree(AZIMUTH_STEPS),1) + "#"; + return String(_mount->getStepsPerDegree(AZIMUTH_STEPS), 1) + "#"; } else if ((inCmd[1] == 'A') && (inCmd.length() > 2) && (inCmd[2] == 'H')) // :XGAH# { diff --git a/src/Mount.cpp b/src/Mount.cpp index 9ceca386..bd2a94b4 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -78,7 +78,7 @@ Mount::Mount(LcdMenu *lcdMenu) { _commandReceived = 0; - _lcdMenu = lcdMenu; + _lcdMenu = lcdMenu; initializeVariables(); } @@ -190,15 +190,15 @@ void Mount::readPersistentData() _stepsPerDECDegree = EEPROMStore::getDECStepsPerDegree(); LOG(DEBUG_INFO, "[MOUNT]: EEPROM: DEC steps/deg is %f", _stepsPerDECDegree); - #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) +#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) _stepsPerAZDegree = EEPROMStore::getAZStepsPerDegree(); LOG(DEBUG_INFO, "[MOUNT]: EEPROM: AZ steps/deg is %f", _stepsPerAZDegree); - #endif +#endif - #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) _stepsPerALTDegree = EEPROMStore::getALTStepsPerDegree(); LOG(DEBUG_INFO, "[MOUNT]: EEPROM: ALT steps/deg is %f", _stepsPerALTDegree); - #endif +#endif float speed = EEPROMStore::getSpeedFactor(); LOG(DEBUG_INFO, "[MOUNT]: EEPROM: Speed factor is %f", speed); setSpeedCalibration(speed, false); @@ -1003,19 +1003,19 @@ float Mount::getStepsPerDegree(StepperAxis which) } if (which == AZIMUTH_STEPS) { - #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) +#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) return _stepsPerAZDegree; // u-steps/degree - #else +#else return 1; - #endif +#endif } if (which == ALTITUDE_STEPS) { - #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) return _stepsPerALTDegree; // u-steps/degree - #else +#else return 1; - #endif +#endif } return 0; @@ -1040,20 +1040,20 @@ void Mount::setStepsPerDegree(StepperAxis which, float steps) EEPROMStore::storeRAStepsPerDegree(_stepsPerRADegree); setSpeedCalibration(_trackingSpeedCalibration, false); } - #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) +#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) else if (which == AZIMUTH_STEPS) { _stepsPerAZDegree = steps; EEPROMStore::storeAZStepsPerDegree(_stepsPerAZDegree); } - #endif - #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) +#endif +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) else if (which == ALTITUDE_STEPS) { _stepsPerALTDegree = steps; EEPROMStore::storeALTStepsPerDegree(_stepsPerALTDegree); } - #endif +#endif } ///////////////////////////////// @@ -1621,13 +1621,13 @@ void Mount::stopGuiding(bool ra, bool dec) // Stop DEC guiding and wait for it to stop. _stepperGUIDE->stop(); - #if !defined(ESP32BOARD) +#if !defined(ESP32BOARD) while (_stepperGUIDE->isRunning()) { _stepperGUIDE->run(); _stepperTRK->runSpeed(); } - #endif +#endif _mountStatus &= ~STATUS_GUIDE_PULSE_DEC; } @@ -2678,9 +2678,7 @@ void Mount::waitUntilStopped(byte direction) // Block until all steppers are stopped void Mount::waitUntilAllStopped() { - while (_stepperRA->isRunning() - || _stepperDEC->isRunning() - || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) + while (_stepperRA->isRunning() || _stepperDEC->isRunning() || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) #if FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE || _stepperFocus->isRunning() #endif @@ -3028,12 +3026,12 @@ void Mount::loop() // One of the motors was running last time through the loop, but not anymore, so shutdown the outputs. disableAzAltMotors(); _azAltWasRunning = false; - #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) - EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); - #endif - #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); - #endif + #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); + #endif + #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); + #endif } oneIsRunning = false; @@ -3305,16 +3303,16 @@ void Mount::updateInfoDisplay() { #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) // If we update this display too often while slewing, the serial port is unable to process commands fast enough. Which makes the driver - // timeout, causing ASCOM errors. + // timeout, causing ASCOM errors. // We will update at 30Hz when idle, 5Hz when slewing one axis and skip updates when slewing both. int refreshRateHz = 30; - long now = millis(); - if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) + long now = millis(); + if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) { return; } - - if (isSlewingRAorDEC()) + + if (isSlewingRAorDEC()) { refreshRateHz = 5; } diff --git a/src/Mount.hpp b/src/Mount.hpp index 1d170f9d..7cf00a73 100644 --- a/src/Mount.hpp +++ b/src/Mount.hpp @@ -406,7 +406,7 @@ class Mount void setupInfoDisplay(); void updateInfoDisplay(); InfoDisplayRender *getInfoDisplay(); - long _lastInfoUpdate = 0; // Last time the info display was updated + long _lastInfoUpdate = 0; // Last time the info display was updated #endif // Called by Meade processor every time a command is received. diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 2d9e2696..5ac294a5 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -181,9 +181,9 @@ void setup() #ifdef RA_SERIAL_PORT #ifdef OAE - RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); + RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); #else - RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif // #endif @@ -204,13 +204,13 @@ void setup() #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART // include TMC2209 UART pins #if defined(DEC_DIAG_PIN) - pinMode(DEC_DIAG_PIN, INPUT); + pinMode(DEC_DIAG_PIN, INPUT); #endif #ifdef DEC_SERIAL_PORT #ifdef OAE - DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); + DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); #else - DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver + DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif #endif #endif @@ -456,7 +456,7 @@ void setup() LOG(DEBUG_ANY, "[STEPPERS]: ALT Circumference : %f", ALT_CIRCUMFERENCE); LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/rev : %f", ALTITUDE_STEPS_PER_REV); LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/deg : %f", mount.getStepsPerDegree(ALTITUDE_STEPS)); - LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); + LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); mount.configureALTStepper(ALTmotorPin1, ALTmotorPin2, ALT_STEPPER_SPEED, ALT_STEPPER_ACCELERATION); #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART LOG(DEBUG_ANY, "[STEPPERS]: Configure ALT driver..."); diff --git a/src/testmenu.cpp b/src/testmenu.cpp index 0dcabb51..b046bf42 100644 --- a/src/testmenu.cpp +++ b/src/testmenu.cpp @@ -261,12 +261,12 @@ void TestMenu::listHardware() const int index = 0; Serial.print(F(" Mount: ")); #ifdef OAM - Serial.println(F("OpenAstroMount (OAM)")); + Serial.println(F("OpenAstroMount (OAM)")); #else #ifdef OAE - Serial.println(F("OpenAstroExplorer (OAE)")); + Serial.println(F("OpenAstroExplorer (OAE)")); #else - Serial.println(F("OpenAstroTracker (OAT)")); + Serial.println(F("OpenAstroTracker (OAT)")); #endif #endif @@ -534,9 +534,9 @@ void TestMenu::display() const Serial.println(F("*** OpenAstroMount (OAM) Test Menu ***")); #else #ifdef OAE - Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); + Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); #else - Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); + Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); #endif #endif Serial.print(F("************* ")); From cc688968925c10f5d263f1dcc6b00bcd033c8255 Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 4 Nov 2025 20:23:57 -0800 Subject: [PATCH 11/24] Merged origin --- Configuration_adv.hpp | 9 +++++++++ LocalConfiguration.hpp | 2 ++ src/MeadeCommandProcessor.cpp | 2 ++ src/b_setup.hpp | 2 ++ 4 files changed, 15 insertions(+) diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index cd168333..bec77a73 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -22,6 +22,15 @@ #define BUFFER_LOGS false #endif +#ifndef OAM + #ifndef OAE + #define OAT "OAT" + #endif +#endif +#if defined(OAE) && defined(OAM) + #error "OAE and OAM cannot be defined at the same time" +#endif + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //////// // MOTOR & DRIVER SETTINGS //////// diff --git a/LocalConfiguration.hpp b/LocalConfiguration.hpp index 0c816418..14a00510 100644 --- a/LocalConfiguration.hpp +++ b/LocalConfiguration.hpp @@ -16,6 +16,8 @@ #include "Configuration_local_mksgenlv1.hpp" #elif BOARD == BOARD_ESP32_ESP32DEV && __has_include("Configuration_local_esp32dev.hpp") #include "Configuration_local_esp32dev.hpp" +#elif BOARD == BOARD_OAE_V1 && __has_include("Configuration_local_oae.hpp") + #include "Configuration_local_oae.hpp" #elif __has_include("Configuration_local.hpp") #include "Configuration_local.hpp" #endif \ No newline at end of file diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp index 07889548..370ea4b3 100644 --- a/src/MeadeCommandProcessor.cpp +++ b/src/MeadeCommandProcessor.cpp @@ -1273,6 +1273,8 @@ String MeadeCommandProcessor::handleMeadeGetInfo(String inCmd) { #ifdef OAM return "OpenAstroMount#"; +#elif defined(OAE) + return "OpenAstroExplorer#"; #else return "OpenAstroTracker#"; #endif diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 5ac294a5..e8cb3534 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -282,6 +282,8 @@ void setup() lcdMenu.setCursor(0, 0); #ifdef OAM lcdMenu.printMenu(" OpenAstroMount"); + #elif defined(OAE) + lcdMenu.printMenu(" OpenAstroExplorer"); #else lcdMenu.printMenu("OpenAstroTracker"); #endif From 3f5c2b2b0a45c6c52f6323ff330342b00b597e5a Mon Sep 17 00:00:00 2001 From: Andre Stefanov Date: Sat, 8 Nov 2025 00:02:23 +0100 Subject: [PATCH 12/24] Enhance EEPROM handling by adding checks for disabled stepper axes in AZ and ALT steps storage and retrieval --- .gitignore | 2 ++ src/EPROMStore.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.gitignore b/.gitignore index 552d3173..c32dd46c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .pio .vscode venv +.venv +__pycache__ .idea cmake-* CMakeLists.txt diff --git a/src/EPROMStore.cpp b/src/EPROMStore.cpp index b82d7be8..5784c177 100644 --- a/src/EPROMStore.cpp +++ b/src/EPROMStore.cpp @@ -477,10 +477,14 @@ float EEPROMStore::getAZStepsPerDegree() if (isPresentExtended(AZ_NORM_STEPS_MARKER_FLAG)) { +#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) // Latest version stores 100x steps/deg for 256 MS const float factor = SteppingStorageNormalized / AZ_MICROSTEPPING; azStepsPerDegree = readInt32(AZ_NORM_STEPS_DEGREE_ADDR) / factor; LOG(DEBUG_EEPROM, "[EEPROM]: AZ Normed Marker Present! AZ steps/deg is %f", azStepsPerDegree); +#else + LOG(DEBUG_EEPROM, "[EEPROM]: AZ marker present but AZ axis disabled; ignoring stored value"); +#endif } else { @@ -494,6 +498,7 @@ float EEPROMStore::getAZStepsPerDegree() void EEPROMStore::storeAZStepsPerDegree(float azStepsPerDegree) { // Store steps as 100x steps/deg at 256 MS. +#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) const float factor = SteppingStorageNormalized / AZ_MICROSTEPPING; int32_t val = azStepsPerDegree * factor; LOG(DEBUG_EEPROM, "[EEPROM]: Storing AZ steps to %l (%f)", val, azStepsPerDegree); @@ -501,6 +506,10 @@ void EEPROMStore::storeAZStepsPerDegree(float azStepsPerDegree) updateInt32(AZ_NORM_STEPS_DEGREE_ADDR, val); updateFlagsExtended(AZ_NORM_STEPS_MARKER_FLAG); commit(); // Complete the transaction +#else + LOG(DEBUG_EEPROM, "[EEPROM]: Skipping AZ steps store; AZ axis disabled"); + (void) azStepsPerDegree; +#endif } // Return the ALT steps per degree (actually microsteps per degree). @@ -515,10 +524,14 @@ float EEPROMStore::getALTStepsPerDegree() if (isPresentExtended(ALT_NORM_STEPS_MARKER_FLAG)) { +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) // Latest version stores 100x steps/deg for 256 MS const float factor = SteppingStorageNormalized / ALT_MICROSTEPPING; azStepsPerDegree = readInt32(ALT_NORM_STEPS_DEGREE_ADDR) / factor; LOG(DEBUG_EEPROM, "[EEPROM]: ALT Normed Marker Present! ALT steps/deg is %f", azStepsPerDegree); +#else + LOG(DEBUG_EEPROM, "[EEPROM]: ALT marker present but ALT axis disabled; ignoring stored value"); +#endif } else { @@ -532,6 +545,7 @@ float EEPROMStore::getALTStepsPerDegree() void EEPROMStore::storeALTStepsPerDegree(float azStepsPerDegree) { // Store steps as 100x steps/deg at 256 MS. +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) const float factor = SteppingStorageNormalized / ALT_MICROSTEPPING; int32_t val = azStepsPerDegree * factor; LOG(DEBUG_EEPROM, "[EEPROM]: Storing ALT steps to %l (%f)", val, azStepsPerDegree); @@ -539,6 +553,10 @@ void EEPROMStore::storeALTStepsPerDegree(float azStepsPerDegree) updateInt32(ALT_NORM_STEPS_DEGREE_ADDR, val); updateFlagsExtended(ALT_NORM_STEPS_MARKER_FLAG); commit(); // Complete the transaction +#else + LOG(DEBUG_EEPROM, "[EEPROM]: Skipping ALT steps store; ALT axis disabled"); + (void) azStepsPerDegree; +#endif } int16_t EEPROMStore::getLastFlashedVersion() From f1184c330557112acb16d73856d29f2d4c3c5c93 Mon Sep 17 00:00:00 2001 From: Lutz Date: Fri, 7 Nov 2025 17:01:14 -0800 Subject: [PATCH 13/24] Delete clang-format-diff.patch --- clang-format-diff.patch | 448 ---------------------------------------- 1 file changed, 448 deletions(-) delete mode 100644 clang-format-diff.patch diff --git a/clang-format-diff.patch b/clang-format-diff.patch deleted file mode 100644 index b71ab8e0..00000000 --- a/clang-format-diff.patch +++ /dev/null @@ -1,448 +0,0 @@ -diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp -index 74667a1..82ed67e 100644 ---- a/ConfigurationValidation.hpp -+++ b/ConfigurationValidation.hpp -@@ -90,8 +90,7 @@ - #endif - #endif - #elif defined(BOARD_OAE_V1) -- // Valid -- -+// Valid - - #else - #error Configuration does not support AZ. Use at own risk. -@@ -114,7 +113,7 @@ - #endif - - #elif defined(BOARD_OAE_V1) -- // Valid -+// Valid - - #else - #warning Configuration does not support ALT. Use at own risk. -diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp -index 09ccb3e..cd16833 100644 ---- a/Configuration_adv.hpp -+++ b/Configuration_adv.hpp -@@ -340,13 +340,12 @@ - #ifndef AZ_ROD_PITCH - #define AZ_ROD_PITCH 0.5 - #endif -- #define AZIMUTH_STEPS_PER_REV + \ -- (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev -+ #define AZIMUTH_STEPS_PER_REV \ -+ +(AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / AZ_ROD_PITCH) * AZ_STEPPER_SPR * AZ_MICROSTEPPING) // Actually u-steps/rev - #else - #define AZ_CIRCUMFERENCE 2538.4f - #endif - #endif -- - - #ifndef OAE - #define AZ_WORMGEAR_RATIO 1.0f -@@ -357,7 +356,7 @@ - (AZ_CORRECTION_FACTOR * (AZ_CIRCUMFERENCE / (AZ_PULLEY_TEETH * GT2_BELT_PITCH)) * AZ_STEPPER_SPR \ - * AZ_MICROSTEPPING) // Actually u-steps/rev - #endif -- -+ - #ifndef AZIMUTH_STEPS_PER_ARC_MINUTE - #define AZIMUTH_STEPS_PER_ARC_MINUTE (AZIMUTH_STEPS_PER_REV / (360 * 60.0f)) // Used to determine move distance in steps - #endif -@@ -416,15 +415,16 @@ - #define ALTITUDE_STEPS_PER_REV \ - (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev - -- #else -+ #else - #ifdef OAE - #ifndef ALT_ROD_PITCH - #define ALT_ROD_PITCH 1.25 // mm/rev - #endif - // the Circumference of the ALT rotation. Roughly 146mm radius. - #define ALT_CIRCUMFERENCE 130.0f * 2 * PI -- #define ALTITUDE_STEPS_PER_REV + \ -- (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR * ALT_MICROSTEPPING) // Actually u-steps/rev -+ #define ALTITUDE_STEPS_PER_REV \ -+ +(ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / ALT_ROD_PITCH) * ALT_STEPPER_SPR \ -+ * ALT_MICROSTEPPING) // Actually u-steps/rev - #else - // the Circumference of the AZ rotation. 770mm dia. - #define ALT_CIRCUMFERENCE 2419.0f -@@ -436,9 +436,9 @@ - #define ALT_WORMGEAR_RATIO (40.0f) - #endif - #ifndef ALTITUDE_STEPS_PER_REV -- #define ALTITUDE_STEPS_PER_REV \ -- (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR * ALT_MICROSTEPPING \ -- * ALT_WORMGEAR_RATIO) // Actually u-steps/rev -+ #define ALTITUDE_STEPS_PER_REV \ -+ (ALT_CORRECTION_FACTOR * (ALT_CIRCUMFERENCE / (ALT_PULLEY_TEETH * GT2_BELT_PITCH)) * ALT_STEPPER_SPR \ -+ * ALT_MICROSTEPPING * ALT_WORMGEAR_RATIO) // Actually u-steps/rev - #endif - #endif - #endif -@@ -649,7 +649,6 @@ - // //////// - //////////////////////////////////////////// - -- - // Focuser - #if (FOCUS_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART) - #if defined(ESP32) -diff --git a/Constants.hpp b/Constants.hpp -index 17c0042..f4a9ddd 100644 ---- a/Constants.hpp -+++ b/Constants.hpp -@@ -18,7 +18,7 @@ - - // ESP32 based boards - #define BOARD_ESP32_ESP32DEV 1001 --#define BOARD_OAE_V1 1002 -+#define BOARD_OAE_V1 1002 - - /** - * Supported keypad/display types. Use one of these values for DISPLAY_TYPE configuration matching your used display and keypad. -diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp -index 1bdb4b9..00d3db6 100644 ---- a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp -+++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp -@@ -83,13 +83,13 @@ - - // DISPLAY_TYPE_LCD_JOY_I2C_SSD1306 requires 3 analog inputs in Arduino pin numbering - #ifndef LCD_KEY_SENSE_X_PIN -- //#define LCD_KEY_SENSE_X_PIN 34 -+//#define LCD_KEY_SENSE_X_PIN 34 - #endif - #ifndef LCD_KEY_SENSE_Y_PIN -- //#define LCD_KEY_SENSE_Y_PIN 39 -+//#define LCD_KEY_SENSE_Y_PIN 39 - #endif - #ifndef LCD_KEY_SENSE_PUSH_PIN -- //#define LCD_KEY_SENSE_PUSH_PIN 36 -+//#define LCD_KEY_SENSE_PUSH_PIN 36 - #endif - - //Serial port for external debugging -@@ -103,7 +103,6 @@ - #endif - #endif - -- - // Defines for OAE /////////////////////// - - #ifndef RA_WHEEL_CIRCUMFERENCE -@@ -125,7 +124,7 @@ - #define DEC_WHEEL_CIRCUMFERENCE 1.0f - #endif - #ifndef RA_STEPPER_SPR -- #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper -+ #define RA_STEPPER_SPR (400 * 9) // change to (200 * 9) for 1.8° stepper - #endif - #ifndef DEC_STEPPER_SPR - #define DEC_STEPPER_SPR (200 * 50 * 4.5f) // change to (200 * 9) for 1.8° stepper -diff --git a/src/EPROMStore.cpp b/src/EPROMStore.cpp -index bb20c8e..b82d7be 100644 ---- a/src/EPROMStore.cpp -+++ b/src/EPROMStore.cpp -@@ -469,11 +469,11 @@ void EEPROMStore::storeDECStepsPerDegree(float decStepsPerDegree) - // If it is not present then the default uncalibrated AZ_STEPS_PER_DEGREE value is returned. - float EEPROMStore::getAZStepsPerDegree() - { -- #if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE -+#if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE - float azStepsPerDegree(AZIMUTH_STEPS_PER_REV / 360); // Default value -- #else -+#else - float azStepsPerDegree(1); // Default value -- #endif -+#endif - - if (isPresentExtended(AZ_NORM_STEPS_MARKER_FLAG)) - { -@@ -503,16 +503,15 @@ void EEPROMStore::storeAZStepsPerDegree(float azStepsPerDegree) - commit(); // Complete the transaction - } - -- - // Return the ALT steps per degree (actually microsteps per degree). - // If it is not present then the default uncalibrated ALT_STEPS_PER_DEGREE value is returned. - float EEPROMStore::getALTStepsPerDegree() - { -- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - float azStepsPerDegree(ALTITUDE_STEPS_PER_REV / 360); // Default value -- #else -+#else - float azStepsPerDegree(1); // Default value -- #endif -+#endif - - if (isPresentExtended(ALT_NORM_STEPS_MARKER_FLAG)) - { -@@ -542,7 +541,6 @@ void EEPROMStore::storeALTStepsPerDegree(float azStepsPerDegree) - commit(); // Complete the transaction - } - -- - int16_t EEPROMStore::getLastFlashedVersion() - { - if (isPresentExtended(LAST_FLASHED_MARKER_FLAG)) -diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp -index 7bbe7ec..0788954 100644 ---- a/src/MeadeCommandProcessor.cpp -+++ b/src/MeadeCommandProcessor.cpp -@@ -1858,11 +1858,11 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd) - } - else if ((inCmd[1] == 'A') && (inCmd.length() == 2)) // :XGA# - { -- return String(_mount->getStepsPerDegree(ALTITUDE_STEPS),1) + "#"; -+ return String(_mount->getStepsPerDegree(ALTITUDE_STEPS), 1) + "#"; - } - else if ((inCmd[1] == 'Z') && (inCmd.length() == 2)) // :XGZ# - { -- return String(_mount->getStepsPerDegree(AZIMUTH_STEPS),1) + "#"; -+ return String(_mount->getStepsPerDegree(AZIMUTH_STEPS), 1) + "#"; - } - else if ((inCmd[1] == 'A') && (inCmd.length() > 2) && (inCmd[2] == 'H')) // :XGAH# - { -diff --git a/src/Mount.cpp b/src/Mount.cpp -index 9ceca38..bd2a94b 100644 ---- a/src/Mount.cpp -+++ b/src/Mount.cpp -@@ -78,7 +78,7 @@ Mount::Mount(LcdMenu *lcdMenu) - - { - _commandReceived = 0; -- _lcdMenu = lcdMenu; -+ _lcdMenu = lcdMenu; - initializeVariables(); - } - -@@ -190,15 +190,15 @@ void Mount::readPersistentData() - _stepsPerDECDegree = EEPROMStore::getDECStepsPerDegree(); - LOG(DEBUG_INFO, "[MOUNT]: EEPROM: DEC steps/deg is %f", _stepsPerDECDegree); - -- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) - _stepsPerAZDegree = EEPROMStore::getAZStepsPerDegree(); - LOG(DEBUG_INFO, "[MOUNT]: EEPROM: AZ steps/deg is %f", _stepsPerAZDegree); -- #endif -+#endif - -- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - _stepsPerALTDegree = EEPROMStore::getALTStepsPerDegree(); - LOG(DEBUG_INFO, "[MOUNT]: EEPROM: ALT steps/deg is %f", _stepsPerALTDegree); -- #endif -+#endif - float speed = EEPROMStore::getSpeedFactor(); - LOG(DEBUG_INFO, "[MOUNT]: EEPROM: Speed factor is %f", speed); - setSpeedCalibration(speed, false); -@@ -1003,19 +1003,19 @@ float Mount::getStepsPerDegree(StepperAxis which) - } - if (which == AZIMUTH_STEPS) - { -- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) - return _stepsPerAZDegree; // u-steps/degree -- #else -+#else - return 1; -- #endif -+#endif - } - if (which == ALTITUDE_STEPS) - { -- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - return _stepsPerALTDegree; // u-steps/degree -- #else -+#else - return 1; -- #endif -+#endif - } - - return 0; -@@ -1040,20 +1040,20 @@ void Mount::setStepsPerDegree(StepperAxis which, float steps) - EEPROMStore::storeRAStepsPerDegree(_stepsPerRADegree); - setSpeedCalibration(_trackingSpeedCalibration, false); - } -- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) - else if (which == AZIMUTH_STEPS) - { - _stepsPerAZDegree = steps; - EEPROMStore::storeAZStepsPerDegree(_stepsPerAZDegree); - } -- #endif -- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) -+#endif -+#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - else if (which == ALTITUDE_STEPS) - { - _stepsPerALTDegree = steps; - EEPROMStore::storeALTStepsPerDegree(_stepsPerALTDegree); - } -- #endif -+#endif - } - - ///////////////////////////////// -@@ -1621,13 +1621,13 @@ void Mount::stopGuiding(bool ra, bool dec) - // Stop DEC guiding and wait for it to stop. - _stepperGUIDE->stop(); - -- #if !defined(ESP32BOARD) -+#if !defined(ESP32BOARD) - while (_stepperGUIDE->isRunning()) - { - _stepperGUIDE->run(); - _stepperTRK->runSpeed(); - } -- #endif -+#endif - - _mountStatus &= ~STATUS_GUIDE_PULSE_DEC; - } -@@ -2678,9 +2678,7 @@ void Mount::waitUntilStopped(byte direction) - // Block until all steppers are stopped - void Mount::waitUntilAllStopped() - { -- while (_stepperRA->isRunning() -- || _stepperDEC->isRunning() -- || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) -+ while (_stepperRA->isRunning() || _stepperDEC->isRunning() || (((_mountStatus & STATUS_TRACKING) == 0) && _stepperTRK->isRunning()) - #if FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE - || _stepperFocus->isRunning() - #endif -@@ -3028,12 +3026,12 @@ void Mount::loop() - // One of the motors was running last time through the loop, but not anymore, so shutdown the outputs. - disableAzAltMotors(); - _azAltWasRunning = false; -- #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) -- EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); -- #endif -- #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) -- EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); -- #endif -+ #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) -+ EEPROMStore::storeAZPosition(_stepperAZ->currentPosition()); -+ #endif -+ #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) -+ EEPROMStore::storeALTPosition(_stepperALT->currentPosition()); -+ #endif - } - - oneIsRunning = false; -@@ -3305,16 +3303,16 @@ void Mount::updateInfoDisplay() - { - #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - // If we update this display too often while slewing, the serial port is unable to process commands fast enough. Which makes the driver -- // timeout, causing ASCOM errors. -+ // timeout, causing ASCOM errors. - // We will update at 30Hz when idle, 5Hz when slewing one axis and skip updates when slewing both. - int refreshRateHz = 30; -- long now = millis(); -- if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) -+ long now = millis(); -+ if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) - { - return; - } -- -- if (isSlewingRAorDEC()) -+ -+ if (isSlewingRAorDEC()) - { - refreshRateHz = 5; - } -diff --git a/src/Mount.hpp b/src/Mount.hpp -index 1d170f9..7cf00a7 100644 ---- a/src/Mount.hpp -+++ b/src/Mount.hpp -@@ -406,7 +406,7 @@ class Mount - void setupInfoDisplay(); - void updateInfoDisplay(); - InfoDisplayRender *getInfoDisplay(); -- long _lastInfoUpdate = 0; // Last time the info display was updated -+ long _lastInfoUpdate = 0; // Last time the info display was updated - #endif - - // Called by Meade processor every time a command is received. -diff --git a/src/b_setup.hpp b/src/b_setup.hpp -index 2d9e269..5ac294a 100644 ---- a/src/b_setup.hpp -+++ b/src/b_setup.hpp -@@ -181,9 +181,9 @@ void setup() - - #ifdef RA_SERIAL_PORT - #ifdef OAE -- RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); -+ RA_SERIAL_PORT.begin(57600, SERIAL_8N1, RA_TX_PIN, RA_RX_PIN); - #else -- RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver -+ RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver - #endif - // - #endif -@@ -204,13 +204,13 @@ void setup() - #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART - // include TMC2209 UART pins - #if defined(DEC_DIAG_PIN) -- pinMode(DEC_DIAG_PIN, INPUT); -+ pinMode(DEC_DIAG_PIN, INPUT); - #endif - #ifdef DEC_SERIAL_PORT - #ifdef OAE -- DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); -+ DEC_SERIAL_PORT.begin(57600, SERIAL_8N1, DEC_TX_PIN, DEC_RX_PIN); - #else -- DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver -+ DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver - #endif - #endif - #endif -@@ -456,7 +456,7 @@ void setup() - LOG(DEBUG_ANY, "[STEPPERS]: ALT Circumference : %f", ALT_CIRCUMFERENCE); - LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/rev : %f", ALTITUDE_STEPS_PER_REV); - LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/deg : %f", mount.getStepsPerDegree(ALTITUDE_STEPS)); -- LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); -+ LOG(DEBUG_ANY, "[STEPPERS]: ALT steps/minute : %f", ALTITUDE_STEPS_PER_ARC_MINUTE); - mount.configureALTStepper(ALTmotorPin1, ALTmotorPin2, ALT_STEPPER_SPEED, ALT_STEPPER_ACCELERATION); - #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART - LOG(DEBUG_ANY, "[STEPPERS]: Configure ALT driver..."); -diff --git a/src/testmenu.cpp b/src/testmenu.cpp -index 0dcabb5..b046bf4 100644 ---- a/src/testmenu.cpp -+++ b/src/testmenu.cpp -@@ -261,12 +261,12 @@ void TestMenu::listHardware() const - int index = 0; - Serial.print(F(" Mount: ")); - #ifdef OAM -- Serial.println(F("OpenAstroMount (OAM)")); -+ Serial.println(F("OpenAstroMount (OAM)")); - #else - #ifdef OAE -- Serial.println(F("OpenAstroExplorer (OAE)")); -+ Serial.println(F("OpenAstroExplorer (OAE)")); - #else -- Serial.println(F("OpenAstroTracker (OAT)")); -+ Serial.println(F("OpenAstroTracker (OAT)")); - #endif - #endif - -@@ -534,9 +534,9 @@ void TestMenu::display() const - Serial.println(F("*** OpenAstroMount (OAM) Test Menu ***")); - #else - #ifdef OAE -- Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); -+ Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); - #else -- Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); -+ Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); - #endif - #endif - Serial.print(F("************* ")); From 790a953e3a67ad9399e8895cc39772c051e92099 Mon Sep 17 00:00:00 2001 From: Lutz Date: Tue, 4 Nov 2025 20:40:59 -0800 Subject: [PATCH 14/24] Fix typo --- src/MeadeCommandProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeadeCommandProcessor.cpp b/src/MeadeCommandProcessor.cpp index 370ea4b3..de66f0f3 100644 --- a/src/MeadeCommandProcessor.cpp +++ b/src/MeadeCommandProcessor.cpp @@ -859,7 +859,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp // "float#" // // :XGT# -// Descrition: +// Description: // Get Tracking speed // Information: // Get the absolute tracking speed of the mount. From 4705edd982d3ccbd636c6b7badfe20f71c6188e2 Mon Sep 17 00:00:00 2001 From: Lutz Date: Fri, 7 Nov 2025 17:06:39 -0800 Subject: [PATCH 15/24] Typo fixes --- src/b_setup.hpp | 2 +- src/testmenu.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/b_setup.hpp b/src/b_setup.hpp index e8cb3534..68c997bf 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -283,7 +283,7 @@ void setup() #ifdef OAM lcdMenu.printMenu(" OpenAstroMount"); #elif defined(OAE) - lcdMenu.printMenu(" OpenAstroExplorer"); + lcdMenu.printMenu("OpenAstroExplorer"); #else lcdMenu.printMenu("OpenAstroTracker"); #endif diff --git a/src/testmenu.cpp b/src/testmenu.cpp index b046bf42..1b0d1763 100644 --- a/src/testmenu.cpp +++ b/src/testmenu.cpp @@ -534,7 +534,7 @@ void TestMenu::display() const Serial.println(F("*** OpenAstroMount (OAM) Test Menu ***")); #else #ifdef OAE - Serial.println(F("*** OpenAstroTracker (OAE) Test Menu ***")); + Serial.println(F("*** OpenAstroExplorer (OAE) Test Menu ***")); #else Serial.println(F("** OpenAstroTracker (OAT) Test Menu **")); #endif From 842483e419090862883636999d92782676381d06 Mon Sep 17 00:00:00 2001 From: Lutz Date: Mon, 12 Jan 2026 22:12:19 -0800 Subject: [PATCH 16/24] V1.13.17 - Updates - Added more output to the InfoDisplay during boot and fixed a bug in console mode. - Fixed a bug that was causing the firmware to hang after a slew, if a :Q# command was issued (thanks to user c3n for tracking it down, pun intended). --- Changelog.md | 4 ++ Configuration_adv.hpp | 4 +- Version.h | 2 +- src/Mount.cpp | 20 ++++-- src/SSD1306_128x64_Display.hpp | 18 ++++-- src/b_setup.hpp | 108 ++++++++++++++++++++++++--------- 6 files changed, 115 insertions(+), 41 deletions(-) diff --git a/Changelog.md b/Changelog.md index 3fd484bc..e7b07c43 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +**V1.13.17 - Updates** +- Added more output to the InfoDisplay during boot and fixed a bug in console mode. +- Fixed a bug that was causing the firmware to hang after a slew, if a :Q# command was issued (thanks to user c3n for tracking it down, pun intended). + **V1.13.16 - Updates** - Throttled InfoDisplay updates. Turned off on two axis slew, limited to 5Hz on one-axis slew. - Guide pulses are now ignored for DEC as well when at the limits. diff --git a/Configuration_adv.hpp b/Configuration_adv.hpp index 3359a6b4..0ad031f0 100644 --- a/Configuration_adv.hpp +++ b/Configuration_adv.hpp @@ -399,7 +399,9 @@ #else // the Circumference of the AZ rotation. 770mm dia. - #define ALT_CIRCUMFERENCE 2419.0f + #ifndef ALT_CIRCUMFERENCE + #define ALT_CIRCUMFERENCE 2419.0f + #endif #if AUTOPA_VERSION == 1 // the ratio of the ALT gearbox for AutoPA V1 (40:3) #define ALT_WORMGEAR_RATIO (40.0f / 3.0f) diff --git a/Version.h b/Version.h index e069b894..9c9e2e2b 100644 --- a/Version.h +++ b/Version.h @@ -3,4 +3,4 @@ // Also, numbers are interpreted as simple numbers. _ __ _ // So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/ -#define VERSION "V1.13.16" +#define VERSION "V1.13.17" diff --git a/src/Mount.cpp b/src/Mount.cpp index 2e4180b5..1df69839 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -349,7 +349,7 @@ void Mount::configureAZStepper(byte pin1, byte pin2, int maxSpeed, int maxAccele #ifdef NEW_STEPPER_LIB _stepperAZ = new StepperAzSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperAZ->setMaxSpeed(maxSpeed); _stepperAZ->setAcceleration(maxAcceleration); @@ -367,7 +367,7 @@ void Mount::configureALTStepper(byte pin1, byte pin2, int maxSpeed, int maxAccel #ifdef NEW_STEPPER_LIB _stepperALT = new StepperAltSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperALT->setMaxSpeed(maxSpeed); _stepperALT->setAcceleration(maxAcceleration); @@ -758,7 +758,7 @@ void Mount::configureALTdriver(uint16_t ALT_SW_RX, uint16_t ALT_SW_TX, float rse _driverALT->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("ALT"); + UART_Rx_connected = connectToDriver("ALT"); if (!UART_Rx_connected) { digitalWrite(ALT_EN_PIN, @@ -849,7 +849,7 @@ void Mount::configureFocusDriver( _driverFocus->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("FOC"); + UART_Rx_connected = connectToDriver("FOC"); if (!UART_Rx_connected) { digitalWrite(FOCUS_EN_PIN, @@ -1891,7 +1891,7 @@ void Mount::getAZALTPositions(long &azPos, long &altPos) #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) azPos = _stepperAZ->currentPosition(); #else - azPos = 0; + azPos = 0; #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) altPos = _stepperALT->currentPosition(); @@ -2893,6 +2893,16 @@ void Mount::interruptLoop() _stepperDEC->run(); _stepperRA->run(); } + else if (!(_mountStatus & STATUS_TRACKING) && (_stepperTRK->isRunning())) + { + // If we are not tracking, but the tracking stepper is running, we need to let it move. + // This can happen when we need to compensate for a slew (during which the tracker is + // stopped). After the slew, the tracker is advanced by the distance it would have + // travelled during the slew if it had been tracking. + // That compensation uses goto mode (using runToNewPosition()), so we need to use run(), + // since runSpeed() only advances the stepper when it is in constant speed mode. + _stepperTRK->run(); + } } if (_mountStatus & STATUS_FINDING_HOME) diff --git a/src/SSD1306_128x64_Display.hpp b/src/SSD1306_128x64_Display.hpp index 003f32cc..3d823626 100644 --- a/src/SSD1306_128x64_Display.hpp +++ b/src/SSD1306_128x64_Display.hpp @@ -1,4 +1,5 @@ #pragma once +#include #include "SSD1306Wire.h" #include "Utility.hpp" #include "Version.h" @@ -42,6 +43,8 @@ class SDD1306OLED128x64 : public InfoDisplayRender const int _decScalePos = 115; const int yMaxStatus = 63 - 11; + const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode + const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode SSD1306Wire *display; int _sizeMount; @@ -51,7 +54,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender long _lastNumCmds; long _lastUpdate; bool _consoleMode; - String _textList[6]; // At most 6 lines of text in console mode + String _textList[MAX_CONSOLE_LINES]; // Buffer for MAX_CONSOLE_LINES lines of text in console mode int _curLine; public: @@ -64,7 +67,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender _yStatus = 0; _dirStatus = 1; _commLetter = ' '; - for (int i = 0; i < 6; i++) + for (int i = 0; i < MAX_CONSOLE_LINES; i++) { _textList[i] = ""; } @@ -94,6 +97,8 @@ class SDD1306OLED128x64 : public InfoDisplayRender display->setFont(Bitmap5x7); #ifdef OAM display->drawString(32, 6, F("OpenAstroMount")); +#elif defined(OAE) + display->drawString(32, 6, F("OpenAstroExplorer")); #else display->drawString(32, 6, F("OpenAstroTracker")); #endif @@ -101,11 +106,16 @@ class SDD1306OLED128x64 : public InfoDisplayRender // Other lines int y = 21; display->setFont(Bitmap3x5); - for (int i = 0; i < 6; i++) + // Start 6 lines back from current line and display next 6 lines + int indexStart = max(0, _curLine - DISPLAY_CONSOLE_LINES); + int indexEnd = min(indexStart + DISPLAY_CONSOLE_LINES, MAX_CONSOLE_LINES); + for (int i = indexStart; i < indexEnd; i++) { if (_textList[i].length() != 0) { - display->drawString(0, y, _textList[i]); + String text = _textList[i]; + text.toUpperCase(); + display->drawString(0, y, text); } y += 7; } diff --git a/src/b_setup.hpp b/src/b_setup.hpp index cd99525e..62f18230 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -94,6 +94,22 @@ void stepperControlTimerCallback(void *payload) #endif #endif +int addConsoleText(String text) +{ +#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) + return mount.getInfoDisplay()->addConsoleText(text, false); +#else + return -1; +#endif +} + +void updateConsoleText(int line, String newText) +{ +#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) + mount.getInfoDisplay()->updateConsoleText(line, newText); +#endif +} + ///////////////////////////////// // // Main program setup @@ -118,6 +134,8 @@ void setup() #if TEST_VERIFY_MODE == 1 #ifdef OAM Serial.print(F("Booting OAM Firmware ")); + #elif OAE + Serial.print(F("Booting OAE Firmware ")); #else Serial.print(F("Booting OAT Firmware ")); #endif @@ -134,32 +152,46 @@ void setup() #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) LOG(DEBUG_ANY, "[SYSTEM]: Get OLED info screen ready..."); mount.setupInfoDisplay(); + addConsoleText(F("BOOTING " VERSION)); LOG(DEBUG_ANY, "[SYSTEM]: OLED info screen ready!"); - mount.getInfoDisplay()->addConsoleText(F("BOOTING " VERSION), false); #endif #if USE_GPS == 1 + LOG(DEBUG_ANY, "[SYSTEM]: Initializing GPS..."); + #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) + int gpsLine = addConsoleText(F("Initialize GPS..."), false); + #endif GPS_SERIAL_PORT.begin(GPS_BAUD_RATE); + #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) + updateConsoleText(gpsLine, F("Initialize GPS... OK")); + #endif #endif //Turn on dew heater #if DEW_HEATER == 1 + LOG(DEBUG_ANY, "[SYSTEM]: Initializing dew heater..."); + int dewHeaterLine = addConsoleText(F("Enable Dew Heater...")); #if defined(DEW_HEATER_1_PIN) digitalWrite(DEW_HEATER_1_PIN, HIGH); #endif #if defined(DEW_HEATER_2_PIN) digitalWrite(DEW_HEATER_2_PIN, HIGH); #endif + updateConsoleText(dewHeaterLine, F("Enable Dew Heater... OK")); #endif #if (USE_RA_END_SWITCH == 1 || USE_DEC_END_SWITCH == 1) + int endSwitchesLine = addConsoleText(F("Init End Switches...")); LOG(DEBUG_ANY, "[SYSTEM]: Init EndSwitches..."); mount.setupEndSwitches(); + updateConsoleText(endSwitchesLine, F("Init End Switches... OK")); #endif ///////////////////////////////// // Microstepping/driver pins ///////////////////////////////// + int raLine = addConsoleText(F("Init RA axis...")); + LOG(DEBUG_ANY, "[SYSTEM]: Initializing RA microstepping/driver pins..."); pinMode(RA_EN_PIN, OUTPUT); digitalWrite(RA_EN_PIN, LOW); // ENABLE, LOW to enable #if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE || RA_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC @@ -174,12 +206,17 @@ void setup() #endif #endif #if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART + LOG(DEBUG_ANY, "[SYSTEM]: Initializing TMC2209 UART pins and Serial port for RA..."); // include TMC2209 UART pins pinMode(RA_DIAG_PIN, INPUT); #ifdef RA_SERIAL_PORT RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif #endif + updateConsoleText(raLine, F("Init RA axis... OK")); + + int decLine = addConsoleText(F("Init DEC axis...")); + LOG(DEBUG_ANY, "[SYSTEM]: Initializing DEC driver pin %s...", String(DEC_EN_PIN).c_str()); pinMode(DEC_EN_PIN, OUTPUT); digitalWrite(DEC_EN_PIN, LOW); // ENABLE, LOW to enable #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE || DEC_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC @@ -193,15 +230,21 @@ void setup() digitalWrite(DEC_MS2_PIN, HIGH); // MS3 #endif #endif + #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART + LOG(DEBUG_ANY, "[SYSTEM]: Initializing TMC2209 UART pins and Serial port for DEC..."); // include TMC2209 UART pins pinMode(DEC_DIAG_PIN, INPUT); #ifdef DEC_SERIAL_PORT DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif #endif + updateConsoleText(decLine, F("Init DEC axis... OK")); + LOG(DEBUG_ANY, "[SYSTEM]: RA/DEC init complete..."); #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + int azLine = addConsoleText(F("Init AZ axis...")); + LOG(DEBUG_ANY, "[SYSTEM]: Initializing AZ microstepping/driver pins..."); pinMode(AZ_EN_PIN, OUTPUT); digitalWrite(AZ_EN_PIN, HIGH); // Logic HIGH to disable the driver initally #if AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART @@ -211,9 +254,12 @@ void setup() AZ_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif #endif + updateConsoleText(azLine, F("Init AZ axis... OK")); #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + int altLine = addConsoleText(F("Init ALT axis...")); + LOG(DEBUG_ANY, "[SYSTEM]: Initializing ALT microstepping/driver pins..."); pinMode(ALT_EN_PIN, OUTPUT); digitalWrite(ALT_EN_PIN, HIGH); // Logic HIGH to disable the driver initally #if ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART @@ -223,9 +269,11 @@ void setup() ALT_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif #endif + updateConsoleText(altLine, F("Init ALT axis... OK")); #endif #if (FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE) + int focusLine = addConsoleText(F("Init Focuser...")); LOG(DEBUG_FOCUS, "[FOCUS]: setup(): focus disabling enable pin"); pinMode(FOCUS_EN_PIN, OUTPUT); digitalWrite(FOCUS_EN_PIN, HIGH); // Logic HIGH to disable the driver initally @@ -236,38 +284,41 @@ void setup() FOCUS_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver #endif #endif + updateConsoleText(focusLine, F("Init Focuser... OK")); #endif // end microstepping ------------------- -#if USE_HALL_SENSOR_RA_AUTOHOME == 1 +#if USE_HALL_SENSOR_RA_AUTOHOME == 1 || USE_HALL_SENSOR_DEC_AUTOHOME == 1 + int homingLine = addConsoleText(F("Init homing sensors...")); + #if USE_HALL_SENSOR_RA_AUTOHOME == 1 pinMode(RA_HOMING_SENSOR_PIN, INPUT); -#endif + #endif -#if USE_HALL_SENSOR_DEC_AUTOHOME == 1 + #if USE_HALL_SENSOR_DEC_AUTOHOME == 1 pinMode(DEC_HOMING_SENSOR_PIN, INPUT); + #endif + updateConsoleText(homingLine, F("Init homing sensors... OK")); #endif -#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - int eepromLine = mount.getInfoDisplay()->addConsoleText(F("INIT EEPROM...")); -#endif + LOG(DEBUG_ANY, "[SYSTEM]: Initializing EEPROM store..."); + int eepromLine = addConsoleText(F("INIT EEPROM...")); - LOG(DEBUG_ANY, "[SYSTEM]: Get EEPROM store ready..."); EEPROMStore::initialize(); LOG(DEBUG_ANY, "[SYSTEM]: EEPROM store ready!"); - -#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - mount.getInfoDisplay()->updateConsoleText(eepromLine, F("INIT EEPROM... OK")); -#endif + updateConsoleText(eepromLine, F("INIT EEPROM... OK")); // Calling the LCD startup here, I2C can't be found if called earlier #if DISPLAY_TYPE != DISPLAY_TYPE_NONE LOG(DEBUG_ANY, "[SYSTEM]: Get LCD ready..."); + int lcdLine = addConsoleText(F("Init LCD...")); lcdMenu.startup(); // Show a splash screen lcdMenu.setCursor(0, 0); #ifdef OAM lcdMenu.printMenu(" OpenAstroMount"); + #elif defined(OAE) + lcdMenu.printMenu("OpenAstroExplorer"); #else lcdMenu.printMenu("OpenAstroTracker"); #endif @@ -330,6 +381,7 @@ void setup() #if SUPPORT_INFO_DISPLAY == 1 lcdMenu.addItem("INFO", Status_Menu); #endif + updateConsoleText(lcdLine, F("Init LCD... OK")); #endif // DISPLAY_TYPE > 0 @@ -337,16 +389,16 @@ void setup() // Create the command processor singleton LOG(DEBUG_ANY, "[SYSTEM]: Initialize LX200 handler..."); + int commandProcessorLine = addConsoleText(F("Init MEADE handler...")); MeadeCommandProcessor::createProcessor(&mount, &lcdMenu); + updateConsoleText(commandProcessorLine, F("Init MEADE handler... OK")); #if (WIFI_ENABLED == 1) LOG(DEBUG_ANY, "[SYSTEM]: Setup Wifi..."); wifiControl.setup(); #endif -#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - int stepperLine = mount.getInfoDisplay()->addConsoleText(F("INIT STEPPERS...")); -#endif + int stepperLine = addConsoleText(F("Energize Steppers...")); // Configure the mount // Delay for a while to get UARTs booted... @@ -457,13 +509,10 @@ void setup() #endif #endif -#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - mount.getInfoDisplay()->updateConsoleText(stepperLine, F("INIT STEPPERS... OK")); -#endif + LOG(DEBUG_ANY, "[SYSTEM]: Energize Steppers... OK"); + updateConsoleText(stepperLine, F("Energize Steppers... OK")); -#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - mount.getInfoDisplay()->addConsoleText(F("CONFIGURING...")); -#endif + int configureLine = addConsoleText(F("Configure Mount...")); LOG(DEBUG_ANY, "[SYSTEM]: Read Configuration..."); @@ -484,7 +533,7 @@ void setup() // Setup service to periodically service the steppers. #if defined(ESP32) - + LOG(DEBUG_ANY, "[SYSTEM]: Setup StepperControlTask on Core 0..."); disableCore0WDT(); xTaskCreatePinnedToCore(stepperControlTask, // Function to run on this core "StepperControl", // Name of this task @@ -504,10 +553,10 @@ void setup() #endif #endif + updateConsoleText(configureLine, F("Configure Mount... OK")); + #if UART_CONNECTION_TEST_TX == 1 - #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - int testLine = mount.getInfoDisplay()->addConsoleText(F("TEST STEPPERS...")); - #endif + int testLine = addConsoleText(F("Test UARTs...")); #if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART LOG(DEBUG_STEPPERS, "[STEPPERS]: Moving RA axis using UART commands..."); mount.testRA_UART_TX(); @@ -519,9 +568,7 @@ void setup() mount.testDEC_UART_TX(); LOG(DEBUG_STEPPERS, "[STEPPERS]: Finished moving DEC axis using UART commands."); #endif - #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - mount.getInfoDisplay()->updateConsoleText(testLine, F("TEST STEPPERS... OK")); - #endif + updateConsoleText(testLine, F("Test UARTs... OK")); #endif LOG(DEBUG_ANY, "[SYSTEM]: Setting %s hemisphere...", inNorthernHemisphere ? "northern" : "southern"); @@ -535,11 +582,12 @@ void setup() mount.bootComplete(); LOG(DEBUG_ANY, "[SYSTEM]: Boot complete!"); + addConsoleText(F("BOOT COMPLETE!")); #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - mount.getInfoDisplay()->addConsoleText(F("BOOT COMPLETE!")); - delay(250); + delay(500); mount.getInfoDisplay()->setConsoleMode(false); #endif + #if TEST_VERIFY_MODE == 1 TestMenu::getCurrentMenu()->display(); #endif From b03820f851ba30f3a08cd39508cb221724ba816e Mon Sep 17 00:00:00 2001 From: Lutz Date: Mon, 12 Jan 2026 22:17:33 -0800 Subject: [PATCH 17/24] Lint fixes --- src/Mount.cpp | 16 ++++++++-------- src/SSD1306_128x64_Display.hpp | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Mount.cpp b/src/Mount.cpp index 1df69839..bcbcb680 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -349,7 +349,7 @@ void Mount::configureAZStepper(byte pin1, byte pin2, int maxSpeed, int maxAccele #ifdef NEW_STEPPER_LIB _stepperAZ = new StepperAzSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperAZ->setMaxSpeed(maxSpeed); _stepperAZ->setAcceleration(maxAcceleration); @@ -367,7 +367,7 @@ void Mount::configureALTStepper(byte pin1, byte pin2, int maxSpeed, int maxAccel #ifdef NEW_STEPPER_LIB _stepperALT = new StepperAltSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperALT->setMaxSpeed(maxSpeed); _stepperALT->setAcceleration(maxAcceleration); @@ -758,7 +758,7 @@ void Mount::configureALTdriver(uint16_t ALT_SW_RX, uint16_t ALT_SW_TX, float rse _driverALT->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("ALT"); + UART_Rx_connected = connectToDriver("ALT"); if (!UART_Rx_connected) { digitalWrite(ALT_EN_PIN, @@ -849,7 +849,7 @@ void Mount::configureFocusDriver( _driverFocus->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("FOC"); + UART_Rx_connected = connectToDriver("FOC"); if (!UART_Rx_connected) { digitalWrite(FOCUS_EN_PIN, @@ -1891,7 +1891,7 @@ void Mount::getAZALTPositions(long &azPos, long &altPos) #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) azPos = _stepperAZ->currentPosition(); #else - azPos = 0; + azPos = 0; #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) altPos = _stepperALT->currentPosition(); @@ -2896,10 +2896,10 @@ void Mount::interruptLoop() else if (!(_mountStatus & STATUS_TRACKING) && (_stepperTRK->isRunning())) { // If we are not tracking, but the tracking stepper is running, we need to let it move. - // This can happen when we need to compensate for a slew (during which the tracker is - // stopped). After the slew, the tracker is advanced by the distance it would have + // This can happen when we need to compensate for a slew (during which the tracker is + // stopped). After the slew, the tracker is advanced by the distance it would have // travelled during the slew if it had been tracking. - // That compensation uses goto mode (using runToNewPosition()), so we need to use run(), + // That compensation uses goto mode (using runToNewPosition()), so we need to use run(), // since runSpeed() only advances the stepper when it is in constant speed mode. _stepperTRK->run(); } diff --git a/src/SSD1306_128x64_Display.hpp b/src/SSD1306_128x64_Display.hpp index 3d823626..151811f7 100644 --- a/src/SSD1306_128x64_Display.hpp +++ b/src/SSD1306_128x64_Display.hpp @@ -42,9 +42,9 @@ class SDD1306OLED128x64 : public InfoDisplayRender const int _decSize = 43; const int _decScalePos = 115; - const int yMaxStatus = 63 - 11; - const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode - const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode + const int yMaxStatus = 63 - 11; + const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode + const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode SSD1306Wire *display; int _sizeMount; @@ -108,7 +108,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender display->setFont(Bitmap3x5); // Start 6 lines back from current line and display next 6 lines int indexStart = max(0, _curLine - DISPLAY_CONSOLE_LINES); - int indexEnd = min(indexStart + DISPLAY_CONSOLE_LINES, MAX_CONSOLE_LINES); + int indexEnd = min(indexStart + DISPLAY_CONSOLE_LINES, MAX_CONSOLE_LINES); for (int i = indexStart; i < indexEnd; i++) { if (_textList[i].length() != 0) From bb9db73edfaac05a1ac0b2d1dbecf77a0a137f0d Mon Sep 17 00:00:00 2001 From: Lutz Date: Mon, 12 Jan 2026 22:25:33 -0800 Subject: [PATCH 18/24] Logic fix, wrong indentation --- src/Mount.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Mount.cpp b/src/Mount.cpp index bcbcb680..b5498353 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -349,7 +349,7 @@ void Mount::configureAZStepper(byte pin1, byte pin2, int maxSpeed, int maxAccele #ifdef NEW_STEPPER_LIB _stepperAZ = new StepperAzSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperAZ->setMaxSpeed(maxSpeed); _stepperAZ->setAcceleration(maxAcceleration); @@ -367,7 +367,7 @@ void Mount::configureALTStepper(byte pin1, byte pin2, int maxSpeed, int maxAccel #ifdef NEW_STEPPER_LIB _stepperALT = new StepperAltSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperALT->setMaxSpeed(maxSpeed); _stepperALT->setAcceleration(maxAcceleration); @@ -758,7 +758,7 @@ void Mount::configureALTdriver(uint16_t ALT_SW_RX, uint16_t ALT_SW_TX, float rse _driverALT->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("ALT"); + UART_Rx_connected = connectToDriver("ALT"); if (!UART_Rx_connected) { digitalWrite(ALT_EN_PIN, @@ -849,7 +849,7 @@ void Mount::configureFocusDriver( _driverFocus->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("FOC"); + UART_Rx_connected = connectToDriver("FOC"); if (!UART_Rx_connected) { digitalWrite(FOCUS_EN_PIN, @@ -1891,7 +1891,7 @@ void Mount::getAZALTPositions(long &azPos, long &altPos) #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) azPos = _stepperAZ->currentPosition(); #else - azPos = 0; + azPos = 0; #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) altPos = _stepperALT->currentPosition(); @@ -2893,16 +2893,16 @@ void Mount::interruptLoop() _stepperDEC->run(); _stepperRA->run(); } - else if (!(_mountStatus & STATUS_TRACKING) && (_stepperTRK->isRunning())) - { - // If we are not tracking, but the tracking stepper is running, we need to let it move. - // This can happen when we need to compensate for a slew (during which the tracker is - // stopped). After the slew, the tracker is advanced by the distance it would have - // travelled during the slew if it had been tracking. - // That compensation uses goto mode (using runToNewPosition()), so we need to use run(), - // since runSpeed() only advances the stepper when it is in constant speed mode. - _stepperTRK->run(); - } + } + else if (!(_mountStatus & STATUS_TRACKING) && (_stepperTRK->isRunning())) + { + // If we are not tracking, but the tracking stepper is running, we need to let it move. + // This can happen when we need to compensate for a slew (during which the tracker is + // stopped). After the slew, the tracker is advanced by the distance it would have + // travelled during the slew if it had been tracking. + // That compensation uses goto mode (using runToNewPosition()), so we need to use run(), + // since runSpeed() only advances the stepper when it is in constant speed mode. + _stepperTRK->run(); } if (_mountStatus & STATUS_FINDING_HOME) From 74f6ef13e20969af1ab76d85074d9d202596adbc Mon Sep 17 00:00:00 2001 From: Lutz Date: Mon, 12 Jan 2026 22:26:50 -0800 Subject: [PATCH 19/24] More lint fixes --- src/Mount.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mount.cpp b/src/Mount.cpp index b5498353..535cffd5 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -349,7 +349,7 @@ void Mount::configureAZStepper(byte pin1, byte pin2, int maxSpeed, int maxAccele #ifdef NEW_STEPPER_LIB _stepperAZ = new StepperAzSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperAZ->setMaxSpeed(maxSpeed); _stepperAZ->setAcceleration(maxAcceleration); @@ -367,7 +367,7 @@ void Mount::configureALTStepper(byte pin1, byte pin2, int maxSpeed, int maxAccel #ifdef NEW_STEPPER_LIB _stepperALT = new StepperAltSlew(AccelStepper::DRIVER, pin1, pin2); #else - _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); + _stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2); #endif _stepperALT->setMaxSpeed(maxSpeed); _stepperALT->setAcceleration(maxAcceleration); @@ -758,7 +758,7 @@ void Mount::configureALTdriver(uint16_t ALT_SW_RX, uint16_t ALT_SW_TX, float rse _driverALT->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("ALT"); + UART_Rx_connected = connectToDriver("ALT"); if (!UART_Rx_connected) { digitalWrite(ALT_EN_PIN, @@ -849,7 +849,7 @@ void Mount::configureFocusDriver( _driverFocus->pdn_disable(true); #if UART_CONNECTION_TEST_TXRX == 1 bool UART_Rx_connected = false; - UART_Rx_connected = connectToDriver("FOC"); + UART_Rx_connected = connectToDriver("FOC"); if (!UART_Rx_connected) { digitalWrite(FOCUS_EN_PIN, @@ -1891,7 +1891,7 @@ void Mount::getAZALTPositions(long &azPos, long &altPos) #if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) azPos = _stepperAZ->currentPosition(); #else - azPos = 0; + azPos = 0; #endif #if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) altPos = _stepperALT->currentPosition(); From 5ecb69d2426602ec5e07de4334b09cb7b372a971 Mon Sep 17 00:00:00 2001 From: Lutz Date: Thu, 15 Jan 2026 21:56:36 -0800 Subject: [PATCH 20/24] PR feedback addressed --- boards/ESP32_ESP32DEV/pins_OAE_V1.hpp | 8 +- src/InfoDisplayRender.hpp | 115 ++++++- src/Mount.cpp | 3 +- src/SSD1306_128x64_Display.cpp | 419 ++++++++++++++++++++++++ src/SSD1306_128x64_Display.hpp | 451 ++------------------------ src/b_setup.hpp | 2 +- src/fonts128x64.h | 1 + 7 files changed, 552 insertions(+), 447 deletions(-) create mode 100644 src/SSD1306_128x64_Display.cpp diff --git a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp index 00d3db68..c27116b3 100644 --- a/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp +++ b/boards/ESP32_ESP32DEV/pins_OAE_V1.hpp @@ -4,12 +4,6 @@ #pragma once -/** - * @brief a pins configuration file for an ESP32-based OAT. - */ - -#pragma once - // DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering #ifndef RA_STEP_PIN #define RA_STEP_PIN 14 // STEP @@ -131,4 +125,4 @@ #endif #ifndef DEC_PULLEY_TEETH #define DEC_PULLEY_TEETH 1 -#endif \ No newline at end of file +#endif diff --git a/src/InfoDisplayRender.hpp b/src/InfoDisplayRender.hpp index ed8cf2a5..3b1aece0 100644 --- a/src/InfoDisplayRender.hpp +++ b/src/InfoDisplayRender.hpp @@ -1,17 +1,116 @@ #pragma once #include - -class Mount; +#include +#include "OLEDDisplay.h" +#include "fonts128x64.h" +#include "../Configuration.hpp" // Base class to implement a class InfoDisplayRender { + const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode + const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode + +protected: + OLEDDisplay *_display; + long _lastNumCmds; + bool _consoleMode; + String _textList[MAX_CONSOLE_LINES]; + int _curLine; + public: - InfoDisplayRender() {}; + InfoDisplayRender() + { + _consoleMode = true; + _curLine = 0; + for (int i = 0; i < MAX_CONSOLE_LINES; i++) + { + _textList[i] = ""; + } + }; + + virtual void init() + { + _display->init(); + _display->clear(); + _display->displayOn(); + }; + + OLEDDisplay *getDisplayDevice() + { + return _display; + }; + + virtual void renderScreen(void *context) =0; + + // Build the display from the mount + virtual void render(void (*drawContentFunction)(void*)) + { + _display->clear(); + if (drawContentFunction) + { + drawContentFunction(this); + } + + if (_consoleMode) + { + // Console lines + int y = 21; + _display->setFont(Bitmap3x5); + // Start 6 lines back from current line and display next 6 lines + int indexStart = max(0, _curLine - DISPLAY_CONSOLE_LINES); + int indexEnd = min(indexStart + DISPLAY_CONSOLE_LINES, MAX_CONSOLE_LINES); + for (int i = indexStart; i < indexEnd; i++) + { + if (_textList[i].length() != 0) + { + String text = _textList[i]; + text.toUpperCase(); + _display->drawString(0, y, text); + } + y += 7; + } + } + else + { + } + + _display->display(); + }; + + virtual void setConsoleMode(bool active) + { + _consoleMode = active; + }; + + virtual int addConsoleText(const String& text, bool tinyFont = true) + { + int returnIndex = 0; + if (_curLine > MAX_CONSOLE_LINES - 1) + { + for (int i = 0; i < MAX_CONSOLE_LINES - 1; i++) + { + _textList[i] = _textList[i + 1]; + } + _curLine = MAX_CONSOLE_LINES - 1; + _textList[_curLine] = text; + returnIndex = _curLine; + } + else + { + returnIndex = _curLine; + _textList[_curLine++] = text; + } + render(nullptr); + return returnIndex; + }; - virtual void init() {}; - virtual void render(Mount *mount) {}; - virtual void setConsoleMode(bool active) {}; - virtual int addConsoleText(String text, bool tinyFont = true); - virtual void updateConsoleText(int line, String newText); + virtual void updateConsoleText(int line, String text) + { + if (line >= 0 && line < MAX_CONSOLE_LINES) + { + _textList[line] = text; + } + render(nullptr); + }; }; diff --git a/src/Mount.cpp b/src/Mount.cpp index 7bbd44ed..1573ecbb 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -3332,6 +3332,7 @@ void Mount::setupInfoDisplay() infoDisplay = new SDD1306OLED128x64(INFO_DISPLAY_I2C_ADDRESS, INFO_DISPLAY_I2C_SDA_PIN, INFO_DISPLAY_I2C_SCL_PIN); LOG(DEBUG_ANY, "[SYSTEM]: SSD1306 OLED created... initializing"); infoDisplay->init(); + infoDisplay->setConsoleMode(true); LOG(DEBUG_DISPLAY, "[DISPLAY]: Created and initialized SSD1306 OLED class..."); #endif } @@ -3358,7 +3359,7 @@ void Mount::updateInfoDisplay() if (now - _lastInfoUpdate > (1000 / refreshRateHz)) { LOG(DEBUG_DISPLAY, "[DISPLAY]: Render state to OLED ..."); - infoDisplay->render(this); + infoDisplay->renderScreen((void*)this); LOG(DEBUG_DISPLAY, "[DISPLAY]: Rendered state to OLED ..."); _lastInfoUpdate = now; } diff --git a/src/SSD1306_128x64_Display.cpp b/src/SSD1306_128x64_Display.cpp new file mode 100644 index 00000000..bae3c33b --- /dev/null +++ b/src/SSD1306_128x64_Display.cpp @@ -0,0 +1,419 @@ +#include "SSD1306_128x64_Display.hpp" + +#if defined(ESP32) + /* + * ESP32 PROGMEM is fake, and its pgm_read_byte macro makes a useless cast + * which errors out with Werror=useless-cast, which can't be suppressed by + * our PUSH/POP_NO_WARNINGS because the macro expands in OUR code, not their + * header :/ + */ + #undef pgm_read_byte + #define pgm_read_byte(addr) (*(addr)) +#endif + +Mount *SDD1306OLED128x64::_mount = nullptr; + +float sinLookup(float deg) +{ + while (deg < 0.0f) + deg += 360.0f; + while (deg > 360.0f) + deg -= 360.0f; + + if (deg <= 90) + { + int index = (int) roundf(sineSize * deg / 90.0f); + return 1.0f * pgm_read_byte(sineTable + index) / 255.0; + } + else if (deg <= 180) + { + int index = (int) roundf(sineSize * (180.0f - deg) / 90.0f); + return 1.0f * pgm_read_byte(sineTable + index) / 255.0; + } + else if (deg <= 270) + { + int index = (int) roundf(sineSize * (deg - 180.0f) / 90.0f); + return -1.0f * pgm_read_byte(sineTable + index) / 255.0; + } + else if (deg <= 360) + { + int index = (int) roundf(sineSize * (360.0f - deg) / 90.0f); + return -1.0f * pgm_read_byte(sineTable + index) / 255.0; + } + return 0.0f; +} + +SDD1306OLED128x64::SDD1306OLED128x64(uint8_t addr, int sda, int scl) : InfoDisplayRender() +{ + _display = new SSD1306Wire(addr, sda, scl, GEOMETRY_128_64); + _commLetter = ' '; +} + +void SDD1306OLED128x64::renderCallback(void *context) +{ + SDD1306OLED128x64 *display = static_cast(context); + display->drawScreen(); +} + +void SDD1306OLED128x64::drawScreen() +{ + _display->setColor(WHITE); + if (_consoleMode) + { + // Draw header only in console mode, in the area 0,0 to 127,20 + // Logo on the left. Base class renders console output text. + _display->setFont(OATLogo); + _display->drawString(0, 0, "!"); + + // Name on the right + _display->setFont(Bitmap5x7); +#ifdef OAE + _display->drawString(32, 6, F("OpenAstroExplorer")); +#elif defined(OAM) + _display->drawString(32, 6, F("OpenAstroMount")); +#else + _display->drawString(32, 6, F("OpenAstroTracker")); +#endif + } + else + { + // Draw indicators in all other modes + drawIndicators(SDD1306OLED128x64::_mount); + } +} + +// Build the display from the mount +void SDD1306OLED128x64::renderScreen(void *mount) +{ + _mount = (Mount *) mount; + // Call the base + this->InfoDisplayRender::render(renderCallback); +}; + +// Display the tiem left before tracking hits the limit +void SDD1306OLED128x64::drawTime(Mount *mount, String label, const DayTime &time) +{ + char achTemp[24]; + _display->setColor(WHITE); + _display->setFont(Bitmap3x5); + sprintf(achTemp, "%s%02d:%02d", label.c_str(), time.getHours(), time.getMinutes()); + _display->drawString(55, 59, achTemp); +} + +// Draw all the indicators on screen +void SDD1306OLED128x64::drawIndicators(Mount *mount) +{ + char scratchBuffer[24]; + _display->setFont(Bitmap5x7); + _display->setColor(WHITE); + + drawStepperStates(mount); + int ra, dec; + // If a slew is in progress, we don't display the safe time, version, and + // comms indicator, since the progress bar takes up the same space + if (mount->getStepperProgress(ra, dec)) + { + drawProgressBar(ra, dec); + } + else + { + long timeSecs = millis() / 2000; // Change every 2 secs + int index = timeSecs % 5; // Cycle through multiple data displays + + _display->setFont(CommSymbols); + _display->drawString(11, 59, F("L")); // Memory chip icon + _display->setFont(Bitmap3x5); + long availMem = freeMemory(); + if (availMem > 9999) + { + _display->drawString(20, 59, String(availMem / 1024) + "K"); + } + else + { + _display->drawString(20, 59, String(availMem)); + } + + switch (index) + { + case 0: + { + float hoursLeft = mount->checkRALimit(); + DayTime dt(hoursLeft); + drawTime(mount, F("REM "), dt); + } + break; + case 1: + { + drawTime(mount, F("LST "), mount->calculateLst()); + } + break; + case 2: + { + long now = millis(); + long msPerDay = 60L * 60 * 24 * 1000; + int days = (int) (now / msPerDay); + now -= days * msPerDay; + DayTime elapsed(1.0 * now / (1000.0 * 3600.0)); + drawTime(mount, F("UPT "), elapsed); + } + break; + case 3: + { + _display->drawString(55, 59, (String(F(" FW ")) + String(VERSION)).c_str()); + } + break; + case 4: + { + float lat = fabsf(mount->latitude().getTotalHours()); + float lng = fabsf(mount->longitude().getTotalHours()); + const char dirLat = (mount->latitude().getTotalHours() < 0) ? 'S' : 'N'; + const char dirLong = (mount->longitude().getTotalHours() < 0) ? 'W' : 'E'; + sprintf(scratchBuffer, "LOC %s%c %s%c", String(lat, 0).c_str(), dirLat, String(lng, 0).c_str(), dirLong); + _display->drawString(55, 59, scratchBuffer); + } + break; + } + drawCommunicationStatus(mount); + } + drawCoordinates(mount); + drawMountPosition(mount); + drawStatus(mount); +} + +// Display two 2-pixel high progress bar in the last 4 lines of the display +void SDD1306OLED128x64::drawProgressBar(int percRA, int percDEC) +{ + _display->setColor(WHITE); + _display->drawVerticalLine(127, 60, 4); + int raWidth = round(1.28f * percRA); + _display->fillRect(0, 60, raWidth, 2); + int decWidth = round(1.28f * percDEC); + _display->fillRect(0, 62, decWidth, 2); +} + +// Display a rectangle with the stepper label in it +void SDD1306OLED128x64::drawStepperState(String name, bool active, int xoff, int width, int textOffX) +{ + _display->setColor(WHITE); + if (active) + { + _display->fillRect(xoff, 0, width, 11); + } + else + { + _display->drawRect(xoff, 0, width, 11); + } + _display->setColor(INVERSE); + _display->drawString(xoff + 2 + textOffX, 2, name); +} + +// Display all the configured stepper status rectangles +// Focuser is currently not supported, but could be added here, if possible. +void SDD1306OLED128x64::drawStepperStates(Mount *mount) +{ + _display->setFont(Bitmap5x7); + drawStepperState(F("RA"), mount->isAxisRunning(RA_STEPS), 0, 15); + drawStepperState(F("DEC"), mount->isAxisRunning(DEC_STEPS), 16, 21); +#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) + drawStepperState(F("ALT"), mount->isRunningALT(), 38, 21); +#endif +#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) + drawStepperState(F("AZ"), mount->isRunningAZ(), 60, 16); +#endif + drawStepperState(F("GDE"), mount->isGuiding(), 83, 21); + drawStepperState(F("TRK"), mount->isSlewingTRK(), 105, 23, 1); +} + +void SDD1306OLED128x64::drawCommunicationStatus(Mount *mount) +{ + long recvdCmds = mount->getNumCommandsReceived(); + // If we have received any commands since the last display, draw the marker. + + if (_commLetter != ' ') + { + _display->setFont(CommSymbols); + _display->drawString(1, 59, String(_commLetter)); + _commLetter++; + if (_commLetter == 'G') // Past last communication animation frame (F) + { + _commLetter = ' '; + } + } + else if (recvdCmds != _lastNumCmds) + { + _commLetter = 'C'; // First communication animation frame + _lastNumCmds = recvdCmds; + } +} + +// Draw the given coordinate string at the given point +void SDD1306OLED128x64::drawCoordinate(int x, int y, const char *coord) +{ + char achCoord[30]; + char *n = achCoord; + // Since this is not a full font, remap the supported letters to the right character + for (const char *p = coord; *p != 0; p++) + { + switch (*p) + { + case 'R': + *n = '!'; + break; + case 'A': + *n = '&'; + break; + case 'D': + *n = '#'; + break; + case 'E': + *n = '$'; + break; + case 'C': + *n = '%'; + break; + case 'h': + *n = '<'; + break; + case 'm': + *n = ';'; + break; + case 's': + *n = '='; + break; + case '@': + *n = '('; + break; + default: + *n = *p; + break; + } + n++; + } + *n = 0; + _display->setFont(Bitmap7x15); + _display->setColor(WHITE); + _display->drawString(x, y, achCoord); +} + +// Draw the mounts celestial RA and DEC coordinates +void SDD1306OLED128x64::drawCoordinates(Mount *mount) +{ + String rc = mount->RAString(LCD_STRING | CURRENT_STRING); + String dc = mount->DECString(LCD_STRING | CURRENT_STRING); + drawCoordinate(8, 24, rc.c_str()); + drawCoordinate(0, 42, dc.c_str()); +} + +// Map the given RA coordinate to the pixel position on the display +int SDD1306OLED128x64::xRAPixel(float ra) +{ + float rangeRA = rightRA - leftRA; + int x = 4 + (int) round(1.0f * (_raSize - 9) * ((ra - leftRA) / rangeRA)); + return (_leftEdgeMount + x); +} + +// Map the given DEC coordinate to the pixel position on the display +int SDD1306OLED128x64::yDECPixel(float dec) +{ + int y = (int) round(1.0f * (_decSize) * ((dec - bottomDEC) / rangeDEC)); + return (_topEdgeMount + _decSize - y); +} + +// Draw the rectangle with the current and target positions +void SDD1306OLED128x64::drawMountPosition(Mount *mount) +{ + _display->setColor(WHITE); + _display->setFont(Bitmap3x5); + + // DEC tickmarks + for (int p = _topEdgeMount; p <= _topEdgeMount + _decSize; p += 2) + { + _display->setPixel(_decScalePos, p); + } +#if defined(OAM) || defined(OAE) + _display->drawHorizontalLine(_decScalePos - 1, yDECPixel(-180.0), 2); +#endif + _display->drawHorizontalLine(_decScalePos - 1, yDECPixel(-90.0), 2); + _display->drawHorizontalLine(_decScalePos - 1, yDECPixel(0.0), 2); + _display->drawHorizontalLine(_decScalePos - 1, yDECPixel(90.0), 2); + _display->drawHorizontalLine(_decScalePos - 1, yDECPixel(180.0), 2); +// DEC tickmark labels +#if defined(OAM) || defined(OAE) + _display->drawString(_decScalePos + 6, yDECPixel(-180.0f) - 2, F("180")); + _display->drawHorizontalLine(_decScalePos + 3, yDECPixel(-180.0), 2); // Smaller minus sign +#endif + _display->drawString(_decScalePos + 6, yDECPixel(-90.0f) - 2, F("90")); + _display->drawHorizontalLine(_decScalePos + 3, yDECPixel(-90.0), 2); // Smaller minus sign + _display->drawString(_decScalePos + 3, yDECPixel(0.0f) - 2, "0"); + _display->drawString(_decScalePos + 3, yDECPixel(90.0f) - 2, F("90")); + _display->drawString(_decScalePos + 3, yDECPixel(180.0f) - 2, F("180")); + + // DEC Pos Marker + float decStepsPerDeg = mount->getStepsPerDegree(StepperAxis::DEC_STEPS); + long decSteps = mount->getCurrentStepperPosition(StepperAxis::DEC_STEPS); + float decDegrees = decSteps / decStepsPerDeg; + int yMark = yDECPixel(decDegrees); + _display->setPixel(_decScalePos - 2, yMark); + _display->drawVerticalLine(_decScalePos - 3, yMark - 1, 3); + _display->drawVerticalLine(_decScalePos - 4, yMark - 2, 5); + + // RA tickmarks + for (int p = _leftEdgeMount; p <= _leftEdgeMount + _raSize; p += 2) + { + _display->setPixel(p, _raScalePos); + } + _display->drawVerticalLine(xRAPixel(-6.0f), _raScalePos - 1, 2); + _display->drawVerticalLine(xRAPixel(-3.0f), _raScalePos - 1, 2); + _display->drawVerticalLine(xRAPixel(0.0f), _raScalePos - 1, 2); + _display->drawVerticalLine(xRAPixel(3.0f), _raScalePos - 1, 2); + _display->drawVerticalLine(xRAPixel(6.0f), _raScalePos - 1, 2); + + // RA tickmark labels + _display->drawString(xRAPixel(-6.0f) - 1, _raScalePos + 2, "6"); + _display->drawHorizontalLine(xRAPixel(-6.0f) - 4, _raScalePos + 2 + 2, 2); // Smaller minus sign + _display->drawString(xRAPixel(-3.0f) - 1, _raScalePos + 2, "3"); + _display->drawHorizontalLine(xRAPixel(-3.0f) - 4, _raScalePos + 2 + 2, 2); // Smaller minus sign + _display->drawString(xRAPixel(0.0f) - 1, _raScalePos + 2, "0"); + _display->drawString(xRAPixel(3.0f) - 1, _raScalePos + 2, "3"); + _display->drawString(xRAPixel(6.0f) - 1, _raScalePos + 2, "6"); + + float raStepsPerDeg = mount->getStepsPerDegree(StepperAxis::RA_STEPS); + float trkSteps = 1.0f * mount->getCurrentStepperPosition(TRACKING) / (1.0f * RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING); + long raSteps = mount->getCurrentStepperPosition(StepperAxis::RA_STEPS); + float raHours = (trkSteps + raSteps) / raStepsPerDeg / 15.0f; + + // RA Position Marker + int xMark = xRAPixel(raHours); + _display->setPixel(xMark, _raScalePos - 2); + _display->drawHorizontalLine(xMark - 1, _raScalePos - 3, 3); + _display->drawHorizontalLine(xMark - 2, _raScalePos - 4, 5); +} + +// Display the tiem left before tracking hits the limit +void SDD1306OLED128x64::drawSafeTime(Mount *mount) +{ + char achTemp[10]; + float hoursLeft = mount->checkRALimit(); + DayTime dt(hoursLeft); + _display->setColor(WHITE); + _display->setFont(CommSymbols); + _display->drawString(48, 59, "M"); // Clock sign + _display->setFont(Bitmap3x5); + sprintf(achTemp, "%02d:%02d", dt.getHours(), dt.getMinutes()); + _display->drawString(55, 59, achTemp); +} + +// Display the mount status string +void SDD1306OLED128x64::drawStatus(Mount *mount) +{ + _display->setColor(WHITE); + _display->setFont(Bitmap5x7); + String state = mount->getStatusStateString(); + state.toUpperCase(); + _display->drawString(4, 14, state.c_str()); + + // Bouncing pixel (bounce frequency every 1.5s). 180 degrees is one cap. + float deg = 180.0f * (millis() % 1500) / 1500.0f; + int pixPos = (int) round(1.0f * yMaxStatus * sinLookup(deg)); + _display->setPixel(0, 11 + yMaxStatus - pixPos); +} diff --git a/src/SSD1306_128x64_Display.hpp b/src/SSD1306_128x64_Display.hpp index aad49a85..b2bc8a05 100644 --- a/src/SSD1306_128x64_Display.hpp +++ b/src/SSD1306_128x64_Display.hpp @@ -1,6 +1,7 @@ #pragma once #include #include "SSD1306Wire.h" +#include "Configuration.hpp" #include "Utility.hpp" #include "Version.h" #include "fonts128x64.h" @@ -21,6 +22,8 @@ const float sineSize = 18.0; const uint8_t sineTable[] PROGMEM = {0, 22, 44, 66, 87, 108, 128, 146, 164, 180, 195, 209, 221, 231, 240, 246, 251, 254, 255, 255}; +class Mount; + // This class renders the mount status to a 128x64 pixel display controlled by a SSD1306 chip. class SDD1306OLED128x64 : public InfoDisplayRender { @@ -43,465 +46,53 @@ class SDD1306OLED128x64 : public InfoDisplayRender const int _decScalePos = 115; const int yMaxStatus = 63 - 11; - const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode - const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode - SSD1306Wire *display; - int _sizeMount; - int _yStatus; - int _dirStatus; char _commLetter; - long _lastNumCmds; - long _lastUpdate; - bool _consoleMode; - String _textList[MAX_CONSOLE_LINES]; // Buffer for MAX_CONSOLE_LINES lines of text in console mode - int _curLine; + static Mount *_mount; public: - SDD1306OLED128x64(byte addr, int sda, int scl) : InfoDisplayRender() - { - display = new SSD1306Wire(addr, sda, scl, GEOMETRY_128_64); - _sizeMount = 128 - _leftEdgeMount; - _consoleMode = true; - _curLine = 0; - _yStatus = 0; - _dirStatus = 1; - _commLetter = ' '; - for (int i = 0; i < MAX_CONSOLE_LINES; i++) - { - _textList[i] = ""; - } - } - - // Initialize the display - virtual void init() - { - display->init(); - display->clear(); - display->displayOn(); - }; + SDD1306OLED128x64(uint8_t addr, int sda, int scl); + void static renderCallback(void *context); + void drawScreen() ; // Build the display from the mount - virtual void render(Mount *mount) - { - display->clear(); - if (_consoleMode) - { - display->setColor(WHITE); - - // Logo on the left - display->setFont(OATLogo); - display->drawString(0, 0, "!"); - - // Name on the right - display->setFont(Bitmap5x7); -#ifdef OAE - display->drawString(32, 6, F("OpenAstroExplorer")); -#elif defined(OAM) - display->drawString(32, 6, F("OpenAstroMount")); -#elif defined(OAE) - display->drawString(32, 6, F("OpenAstroExplorer")); -#else - display->drawString(32, 6, F("OpenAstroTracker")); -#endif - - // Other lines - int y = 21; - display->setFont(Bitmap3x5); - // Start 6 lines back from current line and display next 6 lines - int indexStart = max(0, _curLine - DISPLAY_CONSOLE_LINES); - int indexEnd = min(indexStart + DISPLAY_CONSOLE_LINES, MAX_CONSOLE_LINES); - for (int i = indexStart; i < indexEnd; i++) - { - if (_textList[i].length() != 0) - { - String text = _textList[i]; - text.toUpperCase(); - display->drawString(0, y, text); - } - y += 7; - } - } - else - { - drawIndicators(mount); - } - display->display(); - }; - - virtual void setConsoleMode(bool active) - { - _consoleMode = active; - }; - - virtual int addConsoleText(String text, bool tinyFont) - { - _textList[_curLine++] = text; - render(NULL); - return _curLine - 1; - }; - - virtual void updateConsoleText(int line, String text) - { - _textList[line] = text; - render(NULL); - }; + void renderScreen(void *mount); // Display the tiem left before tracking hits the limit - void drawTime(Mount *mount, String label, const DayTime &time) - { - char achTemp[24]; - display->setColor(WHITE); - display->setFont(Bitmap3x5); - sprintf(achTemp, "%s%02d:%02d", label.c_str(), time.getHours(), time.getMinutes()); - display->drawString(55, 59, achTemp); - } + void drawTime(Mount *mount, String label, const DayTime &time); // Draw all the indicators on screen - void drawIndicators(Mount *mount) - { - char scratchBuffer[24]; - display->setFont(Bitmap5x7); - display->setColor(WHITE); - - drawStepperStates(mount); - int ra, dec; - // If a slew is in progress, we don't display the safe time, version, and - // comms indicator, since the progress bar takes up the same space - if (mount->getStepperProgress(ra, dec)) - { - drawProgressBar(ra, dec); - } - else - { - long timeSecs = millis() / 2000; // Change every 2 secs - int index = timeSecs % 5; // Cycle through multiple data displays - - display->setFont(CommSymbols); - display->drawString(11, 59, F("L")); // Memory chip icon - display->setFont(Bitmap3x5); - long availMem = freeMemory(); - if (availMem > 9999) - { - display->drawString(20, 59, String(availMem / 1024) + "K"); - } - else - { - display->drawString(20, 59, String(availMem)); - } - - switch (index) - { - case 0: - { - float hoursLeft = mount->checkRALimit(); - DayTime dt(hoursLeft); - drawTime(mount, F("REM "), dt); - } - break; - case 1: - { - drawTime(mount, F("LST "), mount->calculateLst()); - } - break; - case 2: - { - long now = millis(); - long msPerDay = 60L * 60 * 24 * 1000; - int days = (int) (now / msPerDay); - now -= days * msPerDay; - DayTime elapsed(1.0 * now / (1000.0 * 3600.0)); - drawTime(mount, F("UPT "), elapsed); - } - break; - case 3: - { - display->drawString(55, 59, (String(F(" FW ")) + String(VERSION)).c_str()); - } - break; - case 4: - { - float lat = fabsf(mount->latitude().getTotalHours()); - float lng = fabsf(mount->longitude().getTotalHours()); - const char dirLat = (mount->latitude().getTotalHours() < 0) ? 'S' : 'N'; - const char dirLong = (mount->longitude().getTotalHours() < 0) ? 'W' : 'E'; - sprintf(scratchBuffer, "LOC %s%c %s%c", String(lat, 0).c_str(), dirLat, String(lng, 0).c_str(), dirLong); - display->drawString(55, 59, scratchBuffer); - } - break; - } - drawCommunicationStatus(mount); - } - drawCoordinates(mount); - drawMountPosition(mount); - drawStatus(mount); - } + void drawIndicators(Mount *mount); // Display two 2-pixel high progress bar in the last 4 lines of the display - void drawProgressBar(int percRA, int percDEC) - { - display->setColor(WHITE); - display->drawVerticalLine(127, 60, 4); - int raWidth = round(1.28f * percRA); - display->fillRect(0, 60, raWidth, 2); - int decWidth = round(1.28f * percDEC); - display->fillRect(0, 62, decWidth, 2); - } + void drawProgressBar(int percRA, int percDEC); // Display a rectangle with the stepper label in it - void drawStepperState(String name, bool active, int xoff, int width, int textOffX = 0) - { - display->setColor(WHITE); - if (active) - { - display->fillRect(xoff, 0, width, 11); - } - else - { - display->drawRect(xoff, 0, width, 11); - } - display->setColor(INVERSE); - display->drawString(xoff + 2 + textOffX, 2, name); - } + void drawStepperState(String name, bool active, int xoff, int width, int textOffX = 0); // Display all the configured stepper status rectangles // Focuser is currently not supported, but could be added here, if possible. - void drawStepperStates(Mount *mount) - { - display->setFont(Bitmap5x7); - drawStepperState(F("RA"), mount->isAxisRunning(RA_STEPS), 0, 15); - drawStepperState(F("DEC"), mount->isAxisRunning(DEC_STEPS), 16, 21); -#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE) - drawStepperState(F("ALT"), mount->isRunningALT(), 38, 21); -#endif -#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE) - drawStepperState(F("AZ"), mount->isRunningAZ(), 60, 16); -#endif - drawStepperState(F("GDE"), mount->isGuiding(), 83, 21); - drawStepperState(F("TRK"), mount->isSlewingTRK(), 105, 23, 1); - } + void drawStepperStates(Mount *mount); - void drawCommunicationStatus(Mount *mount) - { - long recvdCmds = mount->getNumCommandsReceived(); - // If we have received any commands since the last display, draw the marker. - - if (_commLetter != ' ') - { - display->setFont(CommSymbols); - display->drawString(1, 59, String(_commLetter)); - _commLetter++; - if (_commLetter == 'G') // Past last communication animation frame (F) - { - _commLetter = ' '; - } - } - else if (recvdCmds != _lastNumCmds) - { - _commLetter = 'C'; // First communication animation frame - _lastNumCmds = recvdCmds; - } - } + void drawCommunicationStatus(Mount *mount); // Draw the given coordinate string at the given point - void drawCoordinate(int x, int y, const char *coord) - { - char achCoord[30]; - char *n = achCoord; - // Since this is not a full font, remap the supported letters to the right character - for (const char *p = coord; *p != 0; p++) - { - switch (*p) - { - case 'R': - *n = '!'; - break; - case 'A': - *n = '&'; - break; - case 'D': - *n = '#'; - break; - case 'E': - *n = '$'; - break; - case 'C': - *n = '%'; - break; - case 'h': - *n = '<'; - break; - case 'm': - *n = ';'; - break; - case 's': - *n = '='; - break; - case '@': - *n = '('; - break; - default: - *n = *p; - break; - } - n++; - } - *n = 0; - display->setFont(Bitmap7x15); - display->setColor(WHITE); - display->drawString(x, y, achCoord); - } + void drawCoordinate(int x, int y, const char *coord); // Draw the mounts celestial RA and DEC coordinates - void drawCoordinates(Mount *mount) - { - String rc = mount->RAString(LCD_STRING | CURRENT_STRING); - String dc = mount->DECString(LCD_STRING | CURRENT_STRING); - drawCoordinate(8, 24, rc.c_str()); - drawCoordinate(0, 42, dc.c_str()); - } + void drawCoordinates(Mount *mount); // Map the given RA coordinate to the pixel position on the display - int xRAPixel(float ra) - { - float rangeRA = rightRA - leftRA; - int x = 4 + (int) round(1.0f * (_raSize - 9) * ((ra - leftRA) / rangeRA)); - return (_leftEdgeMount + x); - } + int xRAPixel(float ra); // Map the given DEC coordinate to the pixel position on the display - int yDECPixel(float dec) - { - int y = (int) round(1.0f * (_decSize) * ((dec - bottomDEC) / rangeDEC)); - return (_topEdgeMount + _decSize - y); - } + int yDECPixel(float dec); // Draw the rectangle with the current and target positions - void drawMountPosition(Mount *mount) - { - display->setColor(WHITE); - display->setFont(Bitmap3x5); - - // DEC tickmarks - for (int p = _topEdgeMount; p <= _topEdgeMount + _decSize; p += 2) - { - display->setPixel(_decScalePos, p); - } -#if defined(OAM) || defined(OAE) - display->drawHorizontalLine(_decScalePos - 1, yDECPixel(-180.0), 2); -#endif - display->drawHorizontalLine(_decScalePos - 1, yDECPixel(-90.0), 2); - display->drawHorizontalLine(_decScalePos - 1, yDECPixel(0.0), 2); - display->drawHorizontalLine(_decScalePos - 1, yDECPixel(90.0), 2); - display->drawHorizontalLine(_decScalePos - 1, yDECPixel(180.0), 2); -// DEC tickmark labels -#if defined(OAM) || defined(OAE) - display->drawString(_decScalePos + 6, yDECPixel(-180.0f) - 2, F("180")); - display->drawHorizontalLine(_decScalePos + 3, yDECPixel(-180.0), 2); // Smaller minus sign -#endif - display->drawString(_decScalePos + 6, yDECPixel(-90.0f) - 2, F("90")); - display->drawHorizontalLine(_decScalePos + 3, yDECPixel(-90.0), 2); // Smaller minus sign - display->drawString(_decScalePos + 3, yDECPixel(0.0f) - 2, "0"); - display->drawString(_decScalePos + 3, yDECPixel(90.0f) - 2, F("90")); - display->drawString(_decScalePos + 3, yDECPixel(180.0f) - 2, F("180")); - - // DEC Pos Marker - float decStepsPerDeg = mount->getStepsPerDegree(StepperAxis::DEC_STEPS); - long decSteps = mount->getCurrentStepperPosition(StepperAxis::DEC_STEPS); - float decDegrees = decSteps / decStepsPerDeg; - int yMark = yDECPixel(decDegrees); - display->setPixel(_decScalePos - 2, yMark); - display->drawVerticalLine(_decScalePos - 3, yMark - 1, 3); - display->drawVerticalLine(_decScalePos - 4, yMark - 2, 5); - - // RA tickmarks - for (int p = _leftEdgeMount; p <= _leftEdgeMount + _raSize; p += 2) - { - display->setPixel(p, _raScalePos); - } - display->drawVerticalLine(xRAPixel(-6.0f), _raScalePos - 1, 2); - display->drawVerticalLine(xRAPixel(-3.0f), _raScalePos - 1, 2); - display->drawVerticalLine(xRAPixel(0.0f), _raScalePos - 1, 2); - display->drawVerticalLine(xRAPixel(3.0f), _raScalePos - 1, 2); - display->drawVerticalLine(xRAPixel(6.0f), _raScalePos - 1, 2); - - // RA tickmark labels - display->drawString(xRAPixel(-6.0f) - 1, _raScalePos + 2, "6"); - display->drawHorizontalLine(xRAPixel(-6.0f) - 4, _raScalePos + 2 + 2, 2); // Smaller minus sign - display->drawString(xRAPixel(-3.0f) - 1, _raScalePos + 2, "3"); - display->drawHorizontalLine(xRAPixel(-3.0f) - 4, _raScalePos + 2 + 2, 2); // Smaller minus sign - display->drawString(xRAPixel(0.0f) - 1, _raScalePos + 2, "0"); - display->drawString(xRAPixel(3.0f) - 1, _raScalePos + 2, "3"); - display->drawString(xRAPixel(6.0f) - 1, _raScalePos + 2, "6"); - - float raStepsPerDeg = mount->getStepsPerDegree(StepperAxis::RA_STEPS); - float trkSteps = 1.0f * mount->getCurrentStepperPosition(TRACKING) / (1.0f * RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING); - long raSteps = mount->getCurrentStepperPosition(StepperAxis::RA_STEPS); - float raHours = (trkSteps + raSteps) / raStepsPerDeg / 15.0f; - - // RA Position Marker - int xMark = xRAPixel(raHours); - display->setPixel(xMark, _raScalePos - 2); - display->drawHorizontalLine(xMark - 1, _raScalePos - 3, 3); - display->drawHorizontalLine(xMark - 2, _raScalePos - 4, 5); - } - + void drawMountPosition(Mount *mount); // Display the tiem left before tracking hits the limit - void drawSafeTime(Mount *mount) - { - char achTemp[10]; - float hoursLeft = mount->checkRALimit(); - DayTime dt(hoursLeft); - display->setColor(WHITE); - display->setFont(CommSymbols); - display->drawString(48, 59, "M"); // Clock sign - display->setFont(Bitmap3x5); - sprintf(achTemp, "%02d:%02d", dt.getHours(), dt.getMinutes()); - display->drawString(55, 59, achTemp); - } - - float sinLookup(float deg) - { - while (deg < 0.0f) - deg += 360.0f; - while (deg > 360.0f) - deg -= 360.0f; - - if (deg <= 90) - { - int index = (int) roundf(sineSize * deg / 90.0f); - return 1.0f * pgm_read_byte(sineTable + index) / 255.0; - } - else if (deg <= 180) - { - int index = (int) roundf(sineSize * (180.0f - deg) / 90.0f); - return 1.0f * pgm_read_byte(sineTable + index) / 255.0; - } - else if (deg <= 270) - { - int index = (int) roundf(sineSize * (deg - 180.0f) / 90.0f); - return -1.0f * pgm_read_byte(sineTable + index) / 255.0; - } - else if (deg <= 360) - { - int index = (int) roundf(sineSize * (360.0f - deg) / 90.0f); - return -1.0f * pgm_read_byte(sineTable + index) / 255.0; - } - return 0.0f; - } + void drawSafeTime(Mount *mount); // Display the mount status string - void drawStatus(Mount *mount) - { - display->setColor(WHITE); - display->setFont(Bitmap5x7); - String state = mount->getStatusStateString(); - state.toUpperCase(); - display->drawString(4, 14, state.c_str()); - - // Bouncing pixel (bounce frequency every 1.5s). 180 degrees is one cap. - float deg = 180.0f * (millis() % 1500) / 1500.0f; - int pixPos = (int) round(1.0f * yMaxStatus * sinLookup(deg)); - display->setPixel(0, 11 + yMaxStatus - pixPos); - } + void drawStatus(Mount *mount); }; diff --git a/src/b_setup.hpp b/src/b_setup.hpp index 4265a7b4..fa3c58da 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -134,7 +134,7 @@ void setup() #if TEST_VERIFY_MODE == 1 #ifdef OAM Serial.print(F("Booting OAM Firmware ")); - #elif OAE + #elif defined(OAE) Serial.print(F("Booting OAE Firmware ")); #else Serial.print(F("Booting OAT Firmware ")); diff --git a/src/fonts128x64.h b/src/fonts128x64.h index be6c8bcb..a0aae3dd 100644 --- a/src/fonts128x64.h +++ b/src/fonts128x64.h @@ -1,3 +1,4 @@ +#pragma once #include // Font generated or edited with the glyphEditor From 8dbe2a1ce845a857268fadcf44849a2ce5a21150 Mon Sep 17 00:00:00 2001 From: Lutz Date: Thu, 15 Jan 2026 21:56:51 -0800 Subject: [PATCH 21/24] PR feedback --- ConfigurationValidation.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp index d43ad2cd..eb31aedb 100644 --- a/ConfigurationValidation.hpp +++ b/ConfigurationValidation.hpp @@ -89,9 +89,8 @@ #error AZ driver address for DRIVER_TYPE_TMC2209_UART not specified. #endif #endif -#elif defined(BOARD_OAE_V1) -// Valid - +#elif defined(OAE) +// Valid OAE configuration #else #error Configuration does not support AZ. Use at own risk. #endif @@ -112,7 +111,7 @@ #endif #endif -#elif defined(BOARD_OAE_V1) +#elif defined(OAE) // Valid #else From 893060cb92b3371c0875c24936ee545be2259d0e Mon Sep 17 00:00:00 2001 From: Lutz Date: Sun, 18 Jan 2026 00:13:00 -0800 Subject: [PATCH 22/24] Linter fixes --- src/InfoDisplayRender.hpp | 8 ++++---- src/Mount.cpp | 2 +- src/SSD1306_128x64_Display.hpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/InfoDisplayRender.hpp b/src/InfoDisplayRender.hpp index 3b1aece0..5a61d390 100644 --- a/src/InfoDisplayRender.hpp +++ b/src/InfoDisplayRender.hpp @@ -11,7 +11,7 @@ class InfoDisplayRender const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode -protected: + protected: OLEDDisplay *_display; long _lastNumCmds; bool _consoleMode; @@ -41,10 +41,10 @@ class InfoDisplayRender return _display; }; - virtual void renderScreen(void *context) =0; + virtual void renderScreen(void *context) = 0; // Build the display from the mount - virtual void render(void (*drawContentFunction)(void*)) + virtual void render(void (*drawContentFunction)(void *)) { _display->clear(); if (drawContentFunction) @@ -83,7 +83,7 @@ class InfoDisplayRender _consoleMode = active; }; - virtual int addConsoleText(const String& text, bool tinyFont = true) + virtual int addConsoleText(const String &text, bool tinyFont = true) { int returnIndex = 0; if (_curLine > MAX_CONSOLE_LINES - 1) diff --git a/src/Mount.cpp b/src/Mount.cpp index 1573ecbb..e41eb05a 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -3359,7 +3359,7 @@ void Mount::updateInfoDisplay() if (now - _lastInfoUpdate > (1000 / refreshRateHz)) { LOG(DEBUG_DISPLAY, "[DISPLAY]: Render state to OLED ..."); - infoDisplay->renderScreen((void*)this); + infoDisplay->renderScreen((void *) this); LOG(DEBUG_DISPLAY, "[DISPLAY]: Rendered state to OLED ..."); _lastInfoUpdate = now; } diff --git a/src/SSD1306_128x64_Display.hpp b/src/SSD1306_128x64_Display.hpp index b2bc8a05..32f14633 100644 --- a/src/SSD1306_128x64_Display.hpp +++ b/src/SSD1306_128x64_Display.hpp @@ -45,7 +45,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender const int _decSize = 43; const int _decScalePos = 115; - const int yMaxStatus = 63 - 11; + const int yMaxStatus = 63 - 11; char _commLetter; static Mount *_mount; @@ -53,7 +53,7 @@ class SDD1306OLED128x64 : public InfoDisplayRender public: SDD1306OLED128x64(uint8_t addr, int sda, int scl); void static renderCallback(void *context); - void drawScreen() ; + void drawScreen(); // Build the display from the mount void renderScreen(void *mount); From dae0c56e0345a11f31aa4a11e30499f07721f493 Mon Sep 17 00:00:00 2001 From: Lutz Date: Sun, 18 Jan 2026 00:19:28 -0800 Subject: [PATCH 23/24] Build fix and PR issue --- src/InfoDisplayRender.hpp | 1 - src/b_setup.hpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/InfoDisplayRender.hpp b/src/InfoDisplayRender.hpp index 5a61d390..f691222e 100644 --- a/src/InfoDisplayRender.hpp +++ b/src/InfoDisplayRender.hpp @@ -1,6 +1,5 @@ #pragma once #include -#include #include "OLEDDisplay.h" #include "fonts128x64.h" #include "../Configuration.hpp" diff --git a/src/b_setup.hpp b/src/b_setup.hpp index fa3c58da..0a4a1b81 100644 --- a/src/b_setup.hpp +++ b/src/b_setup.hpp @@ -159,7 +159,7 @@ void setup() #if USE_GPS == 1 LOG(DEBUG_ANY, "[SYSTEM]: Initializing GPS..."); #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - int gpsLine = addConsoleText(F("Initialize GPS..."), false); + int gpsLine = addConsoleText(F("Initialize GPS...")); #endif GPS_SERIAL_PORT.begin(GPS_BAUD_RATE); #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) From bf4c0fef2aee3d35b66306db90cf01cb1c5f0d69 Mon Sep 17 00:00:00 2001 From: Lutz Date: Sun, 18 Jan 2026 09:35:24 -0800 Subject: [PATCH 24/24] Fixed ESP32 builds - Removed the no-useless-cast warning since it's being triggered in a library we have no control over --- platformio.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index b23a21da..32102b8c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -52,7 +52,6 @@ src_build_flags = -Wno-unused-parameter ; -Wold-style-cast -Wlogical-op - -Wuseless-cast ; Wdouble-promotion can't be enabled until GCC bug 55578 is fixed, since floats are ; implicitly converted to doubles when passed to a variadic function (i.e. a printf-like). ; Else we could disable Wdouble-promotion only for our logv function inside of the LOG macro @@ -83,6 +82,9 @@ upload_protocol = wiring build_flags = ${env.build_flags} -D BOARD=BOARD_AVR_RAMPS +src_build_flags = + ${env.src_build_flags} + -Wuseless-cast debug_tool = avr-stub debug_build_flags = ${env.debug_build_flags}