### OnTask Configuration and Setup Source: https://github.com/hjd1964/onstepx/blob/main/src/lib/tasks/OnTaskExample.ino.txt Defines task behavior constants and initializes the task manager within the Arduino setup function. ```cpp // ----------------------------------------------------------------------------------- // some constants #define OFF 0 #define ON 1 // ----------------------------------------------------------------------------------- // configure settings in this section to experiment, enable/disable the various tasks #define SERIAL_BAUD 115200 // feature name ON/OFF state #define CLOCK_TICK ON #define CLOCK_EXTRA_NOTHING ON #define SHOW_CLOCK_EVERY_SEC OFF #define SHOW_MESSAGE_FOUR_TIMES ON #define SHOW_MESSAGE_10SEC ON #define SHOW_MESSAGE_HALFSEC_FOR_4SEC ON #define PROFILER_VT100 ON #define SHOW_TASKS_PROFILER_EVERY_SEC ON // uncomment the line below to enable using an hardware timer for the CLOCK_TICK #define TASKS_HWTIMER1_ENABLE // ----------------------------------------------------------------------------------- #if SHOW_TASKS_PROFILER_EVERY_SEC == ON #define TASKS_PROFILER_ENABLE #endif #include "OnTask.h" #if SHOW_TASKS_PROFILER_EVERY_SEC == ON #include "profiler.h" #endif // handles to keep track of tasks int clockCountHandle=0; int fourTimesHandle =0; int profilerHandle =0; void setup() { Serial.begin(SERIAL_BAUD); Serial1.begin(SERIAL_BAUD); Serial.println(); Serial.println("Creating tasks..."); Serial.println(); // this helps show what the parameters are: // handle = tasks.add(period_ms, duration_ms, repeat_true_or_false, priority_0to7, callback_function); // success = tasks.requestHardwareTimer(handle, hardware_timer_number_1to4, hardware_timer_priority_0to255); // create an task, the callback function "clockCount" is the process for this handler #if CLOCK_TICK == ON clockCountHandle = tasks.add(1, 0, true, 0, clockCount, "ClkCnt"); Serial.print("ClockCount running every millisecond"); // move this task to a hardware timer bool success = tasks.requestHardwareTimer(clockCountHandle,1); if (success) Serial.println(" on HardwareTimer1"); else Serial.println(); #endif // create/start another task to throw some extra work at the task manager #if CLOCK_EXTRA_NOTHING == ON tasks.add(1, 0, true, 0, clockExtraNothing, "EtraNth"); #endif // create/start another task to show the clock at 1 second intervals #if SHOW_CLOCK_EVERY_SEC == ON tasks.add(1000, 0, true, 2, showClock, "ShowClk"); Serial.println("ShowClock: running every second"); #endif // start another task with a period of 1 second which it then adds 2 seconds to each time it runs (before it stops itself) #if SHOW_MESSAGE_FOUR_TIMES == ON fourTimesHandle=tasks.add(1000, 0, true, 2, fourTimes, "FourTms"); Serial.println("FourTimes: running every 1,2,4,6 seconds"); #endif // create/start another task with a period of 10 seconds #if SHOW_MESSAGE_10SEC == ON tasks.add(10000, 0, true, 4, longCalc, "LngCalc"); Serial.println("TenSec: running every 10 seconds"); #endif // create/start another task with a period of 0.5 seconds and a duration of 4 seconds #if SHOW_MESSAGE_HALFSEC_FOR_4SEC == ON tasks.add(2000, 4000, true, 3, twoSec, "TwoSecs"); Serial.println("TwoSec: running every 2 seconds, for 4 seconds"); Serial.println(); #endif // create/start a task to show the profiler at work #if SHOW_TASKS_PROFILER_EVERY_SEC == ON profilerHandle = tasks.add(250, 0, true, 2, profiler, "Profilr"); Serial.println("Profiler: running every second"); Serial.println(); #endif } void loop() { tasks.yield(); } ``` -------------------------------- ### Task Callback Implementations Source: https://github.com/hjd1964/onstepx/blob/main/src/lib/tasks/OnTaskExample.ino.txt Example callback functions executed by the task scheduler. ```cpp // ----------------------------------------------------------------------------------- // task processes // runs 1000 times a second in a hardware timer, if available, for a millisecond clock volatile long cs=0; void clockCount() { cs++; } // runs 1000 times a second in the task scheduler, to waste some time void clockExtraNothing() { noInterrupts(); cs++; cs--; interrupts(); } ``` -------------------------------- ### Guide / Manual Motion Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for controlling telescope motion, pulse guiding, and setting movement rates. ```APIDOC ## Guide / Manual Motion ### Commands | Command | Reply | Description | | --- | --- | --- | | `:GX90#` | `n.nn#` | Pulse guide rate | | `:Mgdn#` | none | Pulse guide for `n` ms in direction `d` (w, e, n, s) | | `:MGdn#` | `0/1` | Pulse guide for `n` ms in direction `d` (numeric) | | `:Mw#` | none | Move west at current guide rate | | `:Me#` | none | Move east at current guide rate | | `:Mn#` | none | Move north at current guide rate | | `:Ms#` | none | Move south at current guide rate | | `:Mp#` | none | Spiral-search motion | | `:Q#` | none | Stop all slews, abort goto | | `:Qe#` / `:Qw#` | none | Stop east/west motion | | `:Qn#` / `:Qs#` | none | Stop north/south motion | | `:RAn.n#` | none | Set axis1 custom guide rate in deg/s | | `:REn.n#` | none | Set axis2 custom guide rate in deg/s | | `:RG#` | none | Guide rate preset 1x | | `:RC#` | none | Centering rate preset 8x | | `:RM#` | none | Find rate preset 20x | | `:RF#` | none | Fast rate preset 48x | | `:RS#` | none | Slew rate preset, half current goto rate | | `:R0#` .. `:R9#` | none | Numeric guide-rate preset | ``` -------------------------------- ### Goto, Sync, and Alignment Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for managing telescope alignment, synchronization, and target positioning. ```APIDOC ## Goto / Sync / Alignment Commands | Command | Reply | Description | | --- | --- | --- | | `:AW#` | `1` | Write alignment model to NV | | `:A?#` | `mno#` | Alignment status: max stars, current star, last required star | | `:A1#` .. `:A9#` | `0/1` | Start manual alignment with that many stars | | `:A+#` | `0/1` | Accept current align point | | `:CS#` | none | Sync to current target coordinates | | `:CM#` | `N/A#` or `E1#`..`E9#` | Sync to current catalog/database object | | `:D#` | `0x7f#` while moving, otherwise raw `#` | LX200 distance-bar style motion indicator | | `:Gr#` | `HH:MM.T#` or `HH:MM:SS#` | Get target RA | | `:GrH#` | `HH:MM:SS.SSSS#` | Get target RA, highest precision | | `:Gd#` | `sDD*MM#` or `sDD*MM:SS#` | Get target Dec | | `:GdH#` | `sDD*MM:SS.SSS#` | Get target Dec, highest precision | | `:Gal#` | `sDD*MM#` or `sDD*MM'SS#` | Get target altitude | | `:GaH#` | `sDD*MM'SS.SSS#` | Get target altitude, highest precision | | `:Gz#` | `DDD*MM#` or `DDD*MM'SS#` | Get target azimuth | | `:GzH#` | `DDD*MM'SS.SSS#` | Get target azimuth, highest precision | | `:MA#` | `0`..`9` | Goto target Alt/Az | | `:MD#` | `0`, `1`, or `2` | Destination pier side for current target | | `:MN#` | `0`..`9` | Goto current position on opposite pier side | | `:MNe#` | `0`..`9` | Force same-position goto to east pier side | | `:MNw#` | `0`..`9` | Force same-position goto to west pier side | | `:MP#` | `0`..`9` | Polar-align goto | | `:MS#` | `0`..`9` | Goto current target | | `:SrHH:MM.T#` | `0/1` | Set target RA | | `:SdsDD*MM#` | `0/1` | Set target Dec | | `:SasDD*MM#` | `0/1` | Set target altitude | | `:SzDDD*MM#` | `0/1` | Set target azimuth | ``` -------------------------------- ### Initialize StallGuard Bin Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md Initial seed values for a new StallGuard bin. ```text base = sg dev = 10 ``` -------------------------------- ### Time, Date, and Site Configuration Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for managing local time, date, geographic location, and site settings. ```APIDOC ## Time / Date / Site ### Commands - `:Ga#` - Get local standard time (12-hour) - `:GC#` - Get local standard calendar date - `:Gc#` - Get local time format indicator - `:GG#` - Get UTC offset - `:Gg#` / `:GgH#` - Get longitude - `:GL#` / `:GLH#` - Get local standard time (24-hour) - `:GM#` / `:GN#` / `:GO#` / `:GP#` - Get site names - `:GS#` / `:GSH#` - Get sidereal time - `:Gt#` / `:GtH#` - Get latitude - `:Gv#` - Get elevation - `:GX80#` - Get UT1 time - `:GX81#` - Get UT1 date - `:GX89#` - Get date/time ready status - `:SC...#` - Set local date - `:SG...#` - Set UTC offset - `:Sg...#` - Set longitude - `:SL...#` - Set local time - `:SM...#` / `:SN...#` / `:SO...#` / `:SP...#` - Set site names - `:St...#` - Set latitude - `:SU...#` - Set DUT1 correction - `:Sv...#` - Set elevation - `:W0#` - `:W3#` - Select active site slot - `:W?#` - Query active site slot ``` -------------------------------- ### Core Telescope and Firmware Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for managing firmware information, system resets, and environmental sensor data. ```APIDOC ## Core Telescope / Firmware / Environment ### Commands - `:B+#` - Increase reticle brightness - `:B-#` - Decrease reticle brightness - `:ECtext#` - Echo text to debug output. `_` becomes space, trailing `&` becomes newline. - `:ERESET#` - Reset the MCU - `:ENVRESET#` - Mark NV storage to be cleared on next boot - `:ESPFLASH#` - Put addon/ESP device into firmware flashing mode - `:GVD#` - Get firmware build date - `:GVM#` - Get firmware name and version - `:GVN#` - Get firmware version number - `:GVP#` - Get product name - `:GVT#` - Get firmware build time - `:GVC#` - Get firmware config/product description - `:GVH#` - Get firmware hardware/pinmap string - `:GX9A#` - Get ambient temperature - `:GX9B#` - Get pressure - `:GX9C#` - Get relative humidity - `:GX9E#` - Get dew point - `:GX9F#` - Get MCU temperature - `:SX9A,sn.n#` - Set ambient temperature - `:SX9B,n.n#` - Set pressure - `:SX9C,n.n#` - Set humidity ``` -------------------------------- ### Goto Extended Settings Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for retrieving and configuring extended slew and meridian flip settings. ```APIDOC ## Goto Extended Settings ### Commands | Command | Reply | Description | | --- | --- | --- | | `:GX92#` | `n.nnn#` | Current slew period in us/step | | `:GX93#` | `n.nnn#` | Base/default slew period in us/step | | `:GX94#` | `n` | Current pier side: `0` none, `1` east, `2` west | | `:GX95#` | `0` or `1` | Auto meridian flip enabled | | `:GX96#` | `E`, `W`, `B`, or `A` | Preferred pier side | | `:GX97#` | `n.n#` | Current step rate in deg/s | | `:GX99#` | `n.nnn#` | Fastest allowed slew period in us/step | | `:SX92,n.nnn#` | `0/1` | Set current slew period in us/step | | `:SX93,[1-5]#` | none | Slew preset: `5`=50%, `4`=66.7%, `3`=100%, `2`=150%, `1`=200% | | `:SX94,0#` | `0/1` | Meridian flip home mode: direct slew | | `:SX94,1#` | `0/1` | Meridian flip home mode: visit home | | `:SX94,2#` | `0/1` | Meridian flip home mode: pause at home | | `:SX95,0#` | `0/1` | Disable automatic meridian flip | | `:SX95,1#` | `0/1` | Enable automatic meridian flip | | `:SX96,E#` | `0/1` | Set preferred pier side east | | `:SX96,W#` | `0/1` | Set preferred pier side west | | `:SX96,B#` | `0/1` | Set preferred pier side best | | `:SX96,A#` | `0/1` | Set preferred pier side automatic | | `:SX98,0#` | `0/1` | Legacy pause toggle: change to visit | | `:SX98,1#` | `0/1` | Legacy pause toggle: select pause | | `:SX99,1#` | `0/1` | Continue after pause at home | ``` -------------------------------- ### Configure StallGuard Parameters Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md Define the necessary preprocessor macros to enable and tune StallGuard functionality in the firmware. ```cpp #define DRIVER_TMC_STEPPER #define DRIVER_TMC_STEPPER_STALLGUARD #define SG_ENABLED ON #define SG_TRAIN OFF #define SG_FLOOR 20 #define SG_RAMP_ALLOW 40 #define SG_SENS 50 #define SG_ARM_FPS 150 #define SG_FAULT_MS 200 ``` -------------------------------- ### Object Library Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for managing and navigating astronomical object catalogs. ```APIDOC ## Object Library Commands | Command | Reply | Description | | --- | --- | --- | | `:LB#` | none | Previous object matching current constraints | | `:LCn#` | none | Select record number `n` | | `:LI#` | `name,type#` | Current object name and type | | `:LIG#` | none | Load current object into goto target | | `:LR#` | `name,type,ra,dec#` | Current object info, then advance to next record | | `:LWname,type#` | `0/1` | Write current target RA/Dec to next free record | | `:LN#` | none | Next object matching current constraints | | `:L$#` | `1` | Move to catalog name record | | `:LD#` | none | Clear current record | | `:LL#` | none | Clear current catalog | | `:L!#` | none | Clear all catalogs | | `:L?#` | `n#` | Free records across all catalogs | | `:Lon#` | `0/1` | Select catalog `0..14` | ``` -------------------------------- ### Mount Limit Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to query and set horizon, overhead, and meridian limits. ```APIDOC ## Limit Commands | Command | Reply | Description | | --- | --- | --- | | `:Gh#` | `sDD*#` | Horizon limit | | `:Go#` | `DD*#` | Overhead limit | | `:GXE9#` | `n#` | East meridian limit in minutes | | `:GXEA#` | `n#` | West meridian limit in minutes | | `:GXEe#` | `n#` | Axis1 minimum limit in degrees | | `:GXEw#` | `n#` | Axis1 maximum limit in degrees | | `:GXEB#` | `n#` | Axis1 maximum limit in hours | | `:GXEC#` | `n#` | Axis2 minimum limit in degrees | | `:GXED#` | `n#` | Axis2 maximum limit in degrees | | `:ShsDD#` | `0/1` | Set lower altitude limit | | `:SoDD#` | `0/1` | Set overhead altitude limit | | `:SXE9,n#` | `0/1` | Set east meridian limit in minutes | | `:SXEA,n#` | `0/1` | Set west meridian limit in minutes | ``` -------------------------------- ### Focuser ASCII Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md A collection of ASCII commands for controlling focuser operations, status, and configuration. ```APIDOC ## Focuser ASCII Commands ### Description Commands to control focuser hardware. Commands starting with uppercase letters use microns, while lowercase letters use raw steps. ### Commands - `:FA#` - Get active focuser number - `:FA1#` to `:FA6#` - Select active focuser - `:hP#` - Park all focusers - `:hR#` - Unpark all focusers - `:Fa#` - Check if primary focuser is present - `:FT#` - Get focuser status and goto-rate - `:Fp#` - Get mode (1 for DC/pseudo-absolute, 0 otherwise) - `:FI#` / `:Fi#` - Get full-in/min position - `:FM#` / `:Fm#` - Get maximum position - `:Fe#` - Get temperature delta - `:Ft#` - Get focuser temperature in C - `:Fu#` - Get microns per step - `:FB#` / `:Fb#` - Get backlash - `:FBn#` / `:Fbn#` - Set backlash - `:FC#` - Get TCF coefficient - `:FCsn.n#` - Set TCF coefficient - `:Fc#` - Get TCF enabled status - `:Fc0#` / `:Fc1#` - Disable/enable TCF - `:FD#` / `:Fd#` - Get TCF deadband - `:FDn#` / `:Fdn#` - Set TCF deadband - `:FP#` - Get DC motor power percent - `:FPn#` - Set DC motor power percent - `:FQ#` - Stop focuser - `:F1#` to `:F9#` - Set move/goto rate preset - `:FW#` - Get working goto rate - `:F+#` - Move inward - `:F-#` - Move outward - `:FG#` / `:Fg#` - Get current position - `:FRsn#` / `:Frsn#` - Relative goto - `:FSn#` / `:Fsn#` - Absolute goto - `:FZ#` - Zero current position - `:FH#` - Set current position as home - `:Fh#` - Move to home ``` -------------------------------- ### Retrieve Git Change Log Source: https://github.com/hjd1964/onstepx/blob/main/README.md Command to view a formatted list of recent changes in the project repository. ```bash git log --date=short --pretty=format:"%h %ad %<(20)%an %<(150,trunc)%s" ``` -------------------------------- ### Mount Home Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to manage homing procedures and home-sense configuration. ```APIDOC ## Home Commands | Command | Reply | Description | | --- | --- | --- | | `:h?#` | `hasSense,axis1Offset,axis2Offset#` | Home status | | `:hA0#` / `:hA1#` | none | Disable/enable automatic home at boot | | `:hC#` | none | Move to home | | `:hC1,R#` | none | Toggle axis1 home-sense reversal | | `:hC1,n#` | none | Set axis1 home offset in arcsec | | `:hC2,R#` | none | Toggle axis2 home-sense reversal | | `:hC2,n#` | none | Set axis2 home offset in arcsec | | `:hF#` | none | Reset mount at home/cold-start position | ``` -------------------------------- ### Set Axis Home Offsets Source: https://github.com/hjd1964/onstepx/blob/main/docs/HOMING_NOTES.md Commands to configure the home sense offset for specific mount axes in arcseconds. ```text :hC1,120# ``` ```text :hC2,-300# ``` -------------------------------- ### Configure Remote Focuser Node Source: https://github.com/hjd1964/onstepx/blob/main/docs/CAN_NOTES.md Sets the node to host the focuser implementation remotely. ```c #define CAN_FOCUSER REMOTE #define CAN_FOCUSER_NUMBER 1 #define CAN_SEND_RATE_MS 2 #define CAN_RECV_RATE_MS 10 #define CAN_PLUS CAN2_TEENSY4 #define CAN_BAUD 250000 ``` -------------------------------- ### Schedule Periodic Task Source: https://github.com/hjd1964/onstepx/blob/main/src/lib/tasks/OnTaskExample.ino.txt Demonstrates dynamic task period adjustment, running a task four times with increasing intervals before stopping. ```cpp // run four times then stop, first at 1 seconds, then 2 seconds, etc. void fourTimes() { static int period = 0; if (period <= 4000) { period += 2000; tasks.setPeriod(fourTimesHandle,period); Serial.print("[FourTimes ] next pass in "); Y; Serial.print(period); Y; Serial.println(" ms"); } else { tasks.setPeriod(fourTimesHandle,0); Serial.println("[FourTimes ] done"); } } ``` -------------------------------- ### Mount Park Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to manage the parking state of the mount. ```APIDOC ## Park Commands | Command | Reply | Description | | --- | --- | --- | | `:hP#` | `0/1` | Park mount | | `:hQ#` | `0/1` | Set current position as park | | `:hR#` | `0/1` | Unpark mount | ``` -------------------------------- ### Configure Main Controller CAN Proxy Source: https://github.com/hjd1964/onstepx/blob/main/docs/CAN_NOTES.md Defines the main controller as a proxy for rotator, focuser, and auxiliary features over CAN. ```c #define CAN_ROTATOR ON #define CAN_FOCUSER ON #define CAN_FEATURES ON #define CAN_SEND_RATE_MS 2 #define CAN_RECV_RATE_MS 10 #define CAN_PLUS CAN2_TEENSY4 #define CAN_BAUD 250000 ``` -------------------------------- ### Mount Telemetry and Control Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md A collection of serial commands for querying mount status and configuring tracking and axis parameters. ```APIDOC ## Mount Position and Tracking Commands ### Description Commands to retrieve current mount coordinates, tracking rates, and axis telemetry, as well as commands to modify tracking behavior and mount configuration. ### Commands | Command | Reply | Description | | --- | --- | --- | | `:GA#` | `sDD*MM#` or `sDD*MM'SS#` | Current mount altitude | | `:GAH#` | `sDD*MM'SS.SSS#` | Current mount altitude, highest precision | | `:GD#` | `sDD*MM#` or `sDD*MM:SS#` | Current declination | | `:GDH#` | `sDD*MM:SS.SSS#` | Current declination, highest precision | | `:GR#` | `HH:MM.T#` or `HH:MM:SS#` | Current right ascension | | `:GRH#` | `HH:MM:SS.SSSS#` | Current right ascension, highest precision | | `:GT#` | `n.nnnnn#` or `0#` | Tracking rate in Hz, `0` if not tracking | | `:GZ#` | `DDD*MM#` or `DDD*MM'SS#` | Current azimuth | | `:GZH#` | `DDD*MM'SS.SSS#` | Current azimuth, highest precision | | `:STn.n#` | `0/1` | Set tracking rate in Hz. `0` stops tracking. | | `:Te#` | `0/1` | Enable tracking | | `:Td#` | `0/1` | Disable tracking | | `:TS#` | none | Solar tracking rate | | `:TK#` | none | King tracking rate | | `:TL#` | none | Lunar tracking rate | | `:TQ#` | none | Sidereal tracking rate | ### Mount Type Values | Value | Mount type | | --- | --- | | `1` | GEM | | `2` | FORK | | `3` | ALTAZM | | `4` | ALTALT | | `5` | GEM_TA | | `6` | GEM_TAC | | `7` | FORK_TA | | `8` | FORK_TAC | | `9` | ALTAZM_UNL | ``` -------------------------------- ### Mount Status Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to retrieve mount status and control auxiliary features like the buzzer. ```APIDOC ## Status Commands | Command | Reply | Description | | --- | --- | --- | | `:Gm#` | `E#`, `W#`, or `N#` | Meridian pier side | | `:GU#` | status string | Human-readable packed status | | `:Gu#` | packed bytes | Bit-packed status | | `:GW#` | 4-char status | Mount type, tracking, parked/home, align-done | | `:SX97,0#` | `0/1` | Disable buzzer | | `:SX97,1#` | `0/1` | Enable buzzer | | `:SX97,2#` | `0/1` | Beep | | `:SX97,3#` | `0/1` | Alert tone | | `:SX97,4#` | `0/1` | Click | ``` -------------------------------- ### System Status and Error Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for retrieving error codes and system status. ```APIDOC ## System Status and Error Commands ### Get Last Error Code - **Command**: :GE# - **Reply**: CC# - **Description**: Retrieves the last command error code. ### Status Query - **Command**: <0x06> - **Reply**: A, P, or CK_FAIL - **Description**: Special LX200 status query handled by the buffer/processor. ``` -------------------------------- ### :GXSGn# Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md Retrieves live StallGuard telemetry for a specific axis. ```APIDOC ## :GXSGn# ### Description Returns live StallGuard telemetry for axis `n` when supported. ### Endpoint :GXSGn# ### Parameters #### Path Parameters - **n** (integer) - Required - The axis index to query. ### Response #### Success Response - **sg** (integer) - raw StallGuard result, or -1 if no valid sample is available - **trip** (integer) - current computed trip threshold - **badMs** (integer) - accumulated bad-sample time - **armed** (integer) - 1 when speed is above SG_ARM_FPS - **latched** (integer) - 1 after a StallGuard stall has been declared ``` -------------------------------- ### Calculate StallGuard Margin Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md Default formula for calculating the margin before floor and ramp effects. ```text margin = 80 + 4 * dev ``` -------------------------------- ### Configure Remote Auxiliary-Features Node Source: https://github.com/hjd1964/onstepx/blob/main/docs/CAN_NOTES.md Sets the node to host auxiliary features remotely. ```c #define CAN_FEATURES REMOTE #define CAN_SEND_RATE_MS 2 #define CAN_RECV_RATE_MS 10 #define CAN_PLUS CAN2_TEENSY4 #define CAN_BAUD 250000 ``` -------------------------------- ### Serial Baud Rate Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to set the serial baud rate for the processor. ```APIDOC ## Serial Baud Rate Commands | Command | Reply | Description | | --- | --- | --- | | :SBB# | 1 | Set baud rate to 460800 | | :SBA# | 1 | Set baud rate to 230400 | | :SB0# | 1 | Set baud rate to 115200 | | :SB1# | 1 | Set baud rate to 56700 | | :SB2# | 1 | Set baud rate to 38400 | | :SB3# | 1 | Set baud rate to 28800 | | :SB4# | 1 | Set baud rate to 19200 | | :SB5# | 1 | Set baud rate to 14400 | | :SB6# | 1 | Set baud rate to 9600 | | :SB7# | 1 | Set baud rate to 4800 | | :SB8# | 1 | Set baud rate to 2400 | | :SB9# | 1 | Set baud rate to 1200 | ``` -------------------------------- ### Requesting Home without Sensors Source: https://github.com/hjd1964/onstepx/blob/main/docs/HOMING_NOTES.md Triggers a move to home coordinates when no hardware switches are configured. ```cpp home.request() ``` -------------------------------- ### Alignment Model Extended Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Advanced commands for reading and setting alignment model coefficients and star data. ```APIDOC ## Alignment Model Extended Commands | Command | Reply | Description | | --- | --- | --- | | `:GX00#` | `n#` | `ax1Cor` in arcsec | | `:GX01#` | `n#` | `ax2Cor` in arcsec | | `:GX02#` | `n#` | `altCor` in arcsec | | `:GX03#` | `n#` | `azmCor` in arcsec | | `:GX04#` | `n#` | `doCor` in arcsec | | `:GX05#` | `n#` | `pdCor` in arcsec | | `:GX06#` | `n#` | `ffCor` for FORK/ALTAZM, else `0` | | `:GX07#` | `n#` | `dfCor` for GEM-style mounts, else `0` | | `:GX08#` | `n#` | `tfCor` in arcsec | | `:GX0a#` | `n#` | `hcp` in degrees | | `:GX0b#` | `n#` | `hca` in arcsec | | `:GX0c#` | `n#` | `dcp` in degrees | | `:GX0d#` | `n#` | `dca` in arcsec | | `:GX09#` | `n#` | Number of uploaded stars, then resets internal star index | | `:GX0A#` | `HH:MM:SS#` | Uploaded star actual HA | | `:GX0B#` | `sDD*MM:SS#` | Uploaded star actual Dec | | `:GX0C#` | `HH:MM:SS#` | Uploaded star mount HA | | `:GX0D#` | `sDD*MM:SS#` | Uploaded star mount Dec | | `:GX0E#` | `n#` | Uploaded star pier side, then advances star index | | `:SX00,n#` .. `:SX0d,n#` | `0/1` | Set alignment model coefficients listed above | | `:SX09,0#` | `0/1` | Reset alignment upload state | | `:SX09,1#` | `0/1` | Build model from uploaded stars | | `:SX09,2#` | `0/1` | Force model active | | `:SX0A,HH:MM:SS#` | `0/1` | Upload actual HA for current star | | `:SX0B,sDD*MM:SS#` | `0/1` | Upload actual Dec for current star | | `:SX0C,HH:MM:SS#` | `0/1` | Upload mount HA for current star | | `:SX0D,sDD*MM:SS#` | `0/1` | Upload mount Dec for current star | | `:SX0E,n#` | `0/1` | Upload pier side and advance to next star | ``` -------------------------------- ### Configure Remote Rotator Node Source: https://github.com/hjd1964/onstepx/blob/main/docs/CAN_NOTES.md Sets the node to host the rotator implementation remotely. ```c #define CAN_ROTATOR REMOTE #define CAN_SEND_RATE_MS 2 #define CAN_RECV_RATE_MS 10 #define CAN_PLUS CAN2_TEENSY4 #define CAN_BAUD 250000 ``` -------------------------------- ### Execute Long Background Calculation Source: https://github.com/hjd1964/onstepx/blob/main/src/lib/tasks/OnTaskExample.ino.txt Performs a time-consuming calculation while sending progress updates to Serial1, utilizing the Y macro to maintain system responsiveness. ```cpp // show a long process working in the background void longCalc() { Serial.println("[LongCalc ] started (sending progress to Serial1)"); for (long j=0; j<100; j++) { for (long i=0; i<300; i++) { delayMicroseconds(50); Y; // burn some time } Serial1.print("."); } Serial1.println(); Y; Serial.println("[LongCalc ] done"); } ``` -------------------------------- ### Configure Analog Thresholds and Hysteresis Source: https://github.com/hjd1964/onstepx/blob/main/docs/SENSING_NOTES.md Define active-high or active-low logic with optional hysteresis bands to prevent signal chatter. ```text HIGH | THLD(512) ``` ```text LOW | THLD(300) | HYST(25) ``` ```text HIGH | THLD(800) | HYST(50) ``` -------------------------------- ### Servo Motor Scaling Ratios Source: https://github.com/hjd1964/onstepx/blob/main/docs/SERVO_SETUP.md Ratios used for stepper-based servo drivers to calculate motor-side scaling. ```cpp AXIS*_STEPS_PER_DEGREE / AXIS*_COUNTS_PER_DEGREE ``` ```cpp AXIS*_STEPS_PER_MICRON / AXIS*_COUNTS_PER_MICRON ``` -------------------------------- ### :hC1,n# and :hC2,n# Source: https://github.com/hjd1964/onstepx/blob/main/docs/HOMING_NOTES.md Sets the home offset for axis 1 or axis 2 respectively. ```APIDOC ## :hC1,n# / :hC2,n# ### Description Sets the home offset for the specified mount axis. The offset defines the difference between the switch-detected home position and the desired coordinate home. ### Parameters - **n** (integer) - Required - The offset value in arcseconds. Positive or negative values are supported. ### Examples - `:hC1,120#` (Sets axis 1 home offset to +120 arcsec) - `:hC2,-300#` (Sets axis 2 home offset to -300 arcsec) ``` -------------------------------- ### Auxiliary Features Discovery Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to discover active feature slots and their purposes. ```APIDOC ## :GXY0# ### Description Returns an eight-character bitmap of active feature slots, where '1' indicates the slot is present. ### Command :GXY0# ### Response xxxxxxxx# (Eight-character bitmap) ## :GXYn# ### Description Returns the name and purpose code for a specific feature slot. ### Command :GXYn# (where n is 1..8) ### Response name,purpose# ``` -------------------------------- ### Simple Periodic Task Source: https://github.com/hjd1964/onstepx/blob/main/src/lib/tasks/OnTaskExample.ino.txt A basic task function that prints a status message to the serial monitor. ```cpp // run four times then stop, first at 1 seconds, then 2 seconds, etc. void twoSec() { Serial.println("[TwoSec ] ran"); Y; } ``` -------------------------------- ### Request StallGuard Telemetry Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md Command to retrieve live StallGuard telemetry for a specific axis. ```text :GXSGn# ``` -------------------------------- ### Bad Sample Condition Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md The logical condition used to identify a single bad StallGuard sample. ```text sg < trip ``` -------------------------------- ### StallGuard Telemetry Response Format Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md The structure of the telemetry data returned by the StallGuard command. ```text sg,trip,badMs,armed,latched# ``` -------------------------------- ### Axis Service Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands to retrieve and modify axis, motor, and driver parameters. ```APIDOC ## :GXAa,p# ### Description Get axis parameter 'p' for axis 'a'. ### Command :GXAa,p# (a: 1..9) ### Response value,min,max,type,name# ## :SXAa,p,value# ### Description Set axis parameter 'p' for axis 'a' to a specific value. ### Command :SXAa,p,value# ### Response 0/1 (Success/Failure) ``` -------------------------------- ### Rotator Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md A collection of commands for controlling and querying the status of a rotator device. ```APIDOC ## Rotator Commands | Command | Reply | Description | | --- | --- | --- | | `:rA#` | `0/1` | Rotator active | | `:hP#` | `0/1` | Park rotator | | `:hR#` | `0/1` | Unpark rotator | | `:rT#` | `M1#`, `SD3#`, etc. | Status string plus rate digit | | `:rI#` | `n#` | Minimum angle in degrees | | `:rM#` | `n#` | Maximum angle in degrees | | `:rD#` | `n.n#` | Degrees per step | | `:rb#` | `n#` | Backlash in steps | | `:rbn#` | `0/1` | Set backlash | | `:rQ#` | none | Stop motion | | `:r1#` .. `:r9#` | none | Set move/goto rate preset | | `:rW#` | `n.n#` | Working slew rate in deg/s | | `:rc#` | none | Continuous-move no-op | | `:r>#` | none | Move clockwise | | `:r<#` | none | Move counter-clockwise | | `:rG#` | `sDDD*MM#` | Current angle | | `:rrsDDD*MM#` | none | Relative goto | | `:rSsDDD*MM#` | `0/1` | Absolute goto | | `:rZ#` | none | Zero position | | `:rF#` | none | Set current position to half travel | | `:rC#` | none | Move to half-travel / home target | | `:r+#` | none | Enable derotation | | `:r-#` | none | Disable derotation | | `:rP#` | none | Move to parallactic angle | | `:rR#` | none | Toggle derotator reverse direction | | `:GX98#` | `D#`, `R#`, or `N#` | Rotator capability | | `:GXU3#` | flags | Driver status for rotator axis | ``` -------------------------------- ### StallGuard Threshold Calculation Source: https://github.com/hjd1964/onstepx/blob/main/docs/SG_NOTES.md The formula used to determine the trip threshold based on learned baseline and operational parameters. ```text trip = base - margin - rampExtra + floorAdd ``` -------------------------------- ### Display Clock Time Source: https://github.com/hjd1964/onstepx/blob/main/src/lib/tasks/OnTaskExample.ino.txt Calculates and prints the difference between a stored centisecond value and the current millis() time, using the Y macro to allow higher priority processes to run. ```cpp // show the clock time void showClock() { // Y macros allow any higher priority processes to run Serial.print("[ShowClock ] timer vs. millis() = "); Y; noInterrupts(); long centiSec = cs; interrupts(); Serial.print((long)(millis()-centiSec)); Y; Serial.println(" ms"); } ``` -------------------------------- ### Set Axis Driver Model Source: https://github.com/hjd1964/onstepx/blob/main/docs/SERVO_SETUP.md Define the specific servo driver model for an axis. ```cpp #define AXIS1_DRIVER_MODEL SERVO_PE ``` -------------------------------- ### PEC Commands Source: https://github.com/hjd1964/onstepx/blob/main/docs/COMMAND_REFERENCE.md Commands for configuring and controlling Periodic Error Correction (PEC) for axis 1. ```APIDOC ## PEC Commands | Command | Reply | Description | | --- | --- | --- | | `:GX91#` | `n#` | PEC analog value | | `:GXE6#` | `n.nnnnnn#` | Steps per sidereal second | | `:GXE7#` | `n#` | Worm rotation steps from NV | | `:GXE8#` | `n#` | PEC buffer size in seconds | | `:SXE7,n#` | `0/1` | Set worm rotation steps | | `:VH#` | `nnnnn#` | PEC index sense position in sidereal seconds | | `:VR#` | `snnn,nnn#` | Current PEC segment correction plus segment index | | `:VRn#` | `snnn#` | PEC correction for segment `n` | | `:Vrn#` | `x0x1...x9#` | Ten-byte hex frame of PEC data starting at segment `n` | | `:VS#` | `n.nnnnnn#` | Steps per sidereal second of worm rotation | | `:VW#` | `nnnnnn#` | Worm rotation steps | | `:WR+#` | `0/1` | Rotate PEC table forward one second | | `:WR-#` | `0/1` | Rotate PEC table backward one second | | `:WRn,sn#` | none | Write PEC correction for segment `n` | | `:$QZ+#` | none | Enable PEC playback | | `:$QZ-#` | none | Disable PEC | | `:$QZ/#` | none | Arm PEC recording | | `:$QZZ#` | none | Clear PEC buffer | | `:$QZ!#` | none | Save PEC data to NV | | `:$QZ?#` | `I#`, `p#`, `P#`, `r#`, `R#`, optionally with `.#` | PEC status | ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.