2023.10.06.2200

FEATURE_AZ_POSITION_HH12_AS5045_SSI_RELATIVE: fixed bugs
This commit is contained in:
k3ng 2023-10-06 18:09:57 -04:00
parent dac962649b
commit 3788ad5f6e
2 changed files with 48 additions and 47 deletions

View File

@ -1094,6 +1094,9 @@
2023.10.03.2326 2023.10.03.2326
Fixed bugs in FEATURE_AZ_POSITION_HH12_AS5045_SSI_RELATIVE Fixed bugs in FEATURE_AZ_POSITION_HH12_AS5045_SSI_RELATIVE
2023.10.06.2200
FEATURE_AZ_POSITION_HH12_AS5045_SSI_RELATIVE: fixed bugs
All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc.
Anything rotator_*.* should be in the ino directory! Anything rotator_*.* should be in the ino directory!
@ -1108,7 +1111,7 @@
*/ */
#define CODE_VERSION "2022.02.20.01" #define CODE_VERSION "2023.10.06.2200"
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
@ -8658,20 +8661,22 @@ void read_azimuth(byte force_read){
} }
reading_difference = hh12_last_reading - hh12_current_reading; reading_difference = hh12_last_reading - hh12_current_reading;
// zzzzzzz
if (abs(reading_difference) > 350.0){ // if we moved more than 350 degrees since the last reading, assume we did a 359->0/0->359 transition if (abs(reading_difference) > 250.0){ // if we moved more than X degrees since the last reading, assume we did a 359->0/0->359 transition
#ifdef DEBUG_HH12 #ifdef DEBUG_HH12
debug.print(F("read_azimuth: reading_difference > 350:")); debug.print(F("read_azimuth: reading_difference > 350:"));
control_port->println(reading_difference); debug.print(reading_difference);
debug.println("");
#endif #endif
if (reading_difference > 0){ // we went 359<--CCW--0 if (reading_difference > 0){ // we went 359<--CCW--0
reading_difference = (reading_difference + 360.0) * -1.0;
} else { // we went 359--CW-->0
reading_difference = (reading_difference - 360.0) * -1.0; reading_difference = (reading_difference - 360.0) * -1.0;
} else { // we went 359--CW-->0
reading_difference = (reading_difference + 360.0) * -1.0;
} }
#ifdef DEBUG_HH12 #ifdef DEBUG_HH12
debug.print(F("read_azimuth: reading_difference now:")); debug.print(F("read_azimuth: reading_difference now:"));
control_port->println(reading_difference); debug.print(reading_difference);
debug.println("");
#endif #endif
} }
@ -8684,46 +8689,42 @@ void read_azimuth(byte force_read){
configuration.last_azimuth = raw_azimuth; configuration.last_azimuth = raw_azimuth;
configuration_dirty = 1; configuration_dirty = 1;
#ifdef DEBUG_HH12 #ifdef DEBUG_HH12
debug.print(F("read_azimuth: *reading_difference*:")); if (abs(reading_difference) > 0.9){ // get rid of noise
sprintf(debug_msg,"%.3f",reading_difference); debug.print(F("read_azimuth: *\t"));
debug.print(debug_msg); debug.print(reading_difference);
debug.print(F(" hh12_last_reading:")); // debug.print(F(" hh12_last_reading:"));
sprintf(debug_msg,"%.3f",hh12_last_reading); // debug.print(hh12_last_reading);
debug.print(debug_msg); // debug.print(F(" hh12_current_reading:"));
debug.print(F(" hh12_current_reading:")); // debug.print(hh12_current_reading);
sprintf(debug_msg,"%.3f",hh12_current_reading); debug.print(F("\traw_az:"));
debug.print(debug_msg); debug.print(raw_azimuth);
debug.print(F(" raw_az:")); #if defined(OPTION_REVERSE_AZ_HH12_AS5045)
sprintf(debug_msg,"%.3f",raw_azimuth); debug.print(F(" OPTION_REVERSE_AZ_HH12_AS5045"));
debug.print(debug_msg); #endif
#if defined(OPTION_REVERSE_AZ_HH12_AS5045) debug.println("");
debug.print(F(" OPTION_REVERSE_AZ_HH12_AS5045")); }
#endif
debug.println("");
#endif #endif
} }
#ifdef DEBUG_HH12 // #ifdef DEBUG_HH12
if ((millis() - last_hh12_debug) > 2000) { // if ((millis() - last_hh12_debug) > 2000) {
debug.print(F("read_azimuth: *reading_difference*:")); // last_hh12_debug = millis();
sprintf(debug_msg,"%.3f",reading_difference); // debug.print(F("read_azimuth: *reading_difference*:"));
debug.print(debug_msg); // debug.print(reading_difference);
debug.print(F(" hh12_last_reading:")); // // debug.print(F(" hh12_last_reading:"));
sprintf(debug_msg,"%.3f",hh12_last_reading); // // debug.print(hh12_last_reading);
debug.print(debug_msg); // // debug.print(F(" hh12_current_reading:"));
debug.print(F(" hh12_current_reading:")); // // debug.print(hh12_current_reading);
sprintf(debug_msg,"%.3f",hh12_current_reading); // debug.print(F(" raw_az:"));
debug.print(debug_msg); // debug.print(raw_azimuth);
debug.print(F(" raw_az:")); // #if defined(OPTION_REVERSE_AZ_HH12_AS5045)
sprintf(debug_msg,"%.3f",raw_azimuth); // debug.print(F(" OPTION_REVERSE_AZ_HH12_AS5045"));
debug.print(debug_msg); // #endif
#if defined(OPTION_REVERSE_AZ_HH12_AS5045) // debug.println("");
debug.print(F(" OPTION_REVERSE_AZ_HH12_AS5045")); // debug.println("");
#endif
debug.println(""); // }
last_hh12_debug = millis(); // #endif // DEBUG_HH12
}
#endif // DEBUG_HH12
#ifdef FEATURE_AZIMUTH_CORRECTION #ifdef FEATURE_AZIMUTH_CORRECTION
raw_azimuth = correct_azimuth(raw_azimuth); raw_azimuth = correct_azimuth(raw_azimuth);
@ -14651,7 +14652,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte
byte hit_error = 0; byte hit_error = 0;
#endif // defined(FEATURE_MOON_TRACKING) || defined(FEATURE_SUN_TRACKING) #endif // defined(FEATURE_MOON_TRACKING) || defined(FEATURE_SUN_TRACKING)
#if defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) || defined(FEATURE_AZ_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY) #if defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) || defined(FEATURE_AZ_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY) || defined(FEATURE_AZ_POSITION_HH12_AS5045_SSI_RELATIVE)
float new_azimuth = 9999; float new_azimuth = 9999;
#endif #endif
@ -14687,7 +14688,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte
switch (input_buffer[1]) { switch (input_buffer[1]) {
#if !defined(OPTION_SAVE_MEMORY_EXCLUDE_BACKSLASH_CMDS) #if !defined(OPTION_SAVE_MEMORY_EXCLUDE_BACKSLASH_CMDS)
#if defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) || defined(FEATURE_AZ_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY) #if defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) || defined(FEATURE_AZ_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY) || defined(FEATURE_AZ_POSITION_HH12_AS5045_SSI_RELATIVE)
case 'A': // \Ax[x][x] - manually set azimuth case 'A': // \Ax[x][x] - manually set azimuth
new_azimuth = 9999; new_azimuth = 9999;
switch (input_buffer_index) { switch (input_buffer_index) {

View File

@ -12,7 +12,7 @@
*/ */
#define FEATURE_ELEVATION_CONTROL // uncomment this for AZ/EL rotators // #define FEATURE_ELEVATION_CONTROL // uncomment this for AZ/EL rotators
#define FEATURE_YAESU_EMULATION // uncomment this for Yaesu GS-232 emulation on control port #define FEATURE_YAESU_EMULATION // uncomment this for Yaesu GS-232 emulation on control port
// #define FEATURE_EASYCOM_EMULATION // Easycom protocol emulation on control port (undefine FEATURE_YAESU_EMULATION above) // #define FEATURE_EASYCOM_EMULATION // Easycom protocol emulation on control port (undefine FEATURE_YAESU_EMULATION above)
// #define FEATURE_DCU_1_EMULATION // DCU-1 protocol emulation on control port // #define FEATURE_DCU_1_EMULATION // DCU-1 protocol emulation on control port