From 9785ea8eca743f3b1559c59af96034ad9946a702 Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Mon, 14 Aug 2017 23:10:06 -0400 Subject: [PATCH] 2017.08.14.01 Added \+ command which switched LCD azimuth display mode between normal, raw, and +overlap modes --- .../k3ng_rotator_controller.ino | 135 ++++++++++++++++-- k3ng_rotator_controller/rotator.h | 4 + .../rotator_features_test.h | 12 +- k3ng_rotator_controller/rotator_settings.h | 2 +- .../rotator_settings_ea4tx_ars_usb.h | 2 +- .../rotator_settings_m0upu.h | 2 +- .../rotator_settings_test.h | 2 +- .../rotator_settings_wb6kcn.h | 2 +- 8 files changed, 136 insertions(+), 25 deletions(-) diff --git a/k3ng_rotator_controller/k3ng_rotator_controller.ino b/k3ng_rotator_controller/k3ng_rotator_controller.ino index 0b4fde9..6f15a12 100644 --- a/k3ng_rotator_controller/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller/k3ng_rotator_controller.ino @@ -304,6 +304,9 @@ 2017.08.02.01 FEATURE_AUTOPARK created and documented here https://github.com/k3ng/k3ng_rotator_controller/wiki/705-Park-and-AutoPark + 2017.08.14.01 + Added \+ command which switched LCD azimuth display mode between normal, raw, and +overlap modes + All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. Anything rotator_*.* should be in the ino directory! @@ -313,7 +316,7 @@ */ -#define CODE_VERSION "2017.08.02.01" +#define CODE_VERSION "2017.08.14.01" #include #include @@ -542,6 +545,7 @@ struct config_t { float clock_timezone_offset; byte autopark_active; unsigned int autopark_time_minutes; + byte azimuth_display_mode; } configuration; @@ -3256,11 +3260,31 @@ void update_display(){ #if defined(OPTION_DISPLAY_HEADING) #if !defined(FEATURE_ELEVATION_CONTROL) // ---------------- az only ----------------------------------- strcpy(workstring,AZIMUTH_STRING); - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + case AZ_DISPLAY_MODE_RAW: + dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + } #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} - #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} + if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + break; + case AZ_DISPLAY_MODE_RAW: + if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} + if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + break; + } + #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + strcat(workstring,"+"); + } strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_HEADING_ROW-1,LCD_HEADING_FIELD_SIZE); @@ -3274,11 +3298,31 @@ void update_display(){ #else strcpy(workstring,AZ_SPACE_STRING); #endif // efined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - dtostrf(azimuth/ LCD_HEADING_MULTIPLIER, 3, LCD_DECIMAL_PLACES, workstring2); + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 3, LCD_DECIMAL_PLACES, workstring2); + break; + case AZ_DISPLAY_MODE_RAW: + dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 3, LCD_DECIMAL_PLACES, workstring2); + break; + } #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} + if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + break; + case AZ_DISPLAY_MODE_RAW: + if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} + if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + break; + } #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + strcat(workstring,"+"); + } strcat(workstring,workstring2); #if !defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) if (LCD_COLUMNS > 14) { @@ -3323,11 +3367,31 @@ void update_display(){ // OPTION_DISPLAY_HEADING_AZ_ONLY - show heading *********************************************************************************** #if defined(OPTION_DISPLAY_HEADING_AZ_ONLY) strcpy(workstring,AZIMUTH_STRING); - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + case AZ_DISPLAY_MODE_RAW: + dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + } #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} - #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} + if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + break; + case AZ_DISPLAY_MODE_RAW: + if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} + if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + break; + } + #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + strcat(workstring,"+"); + } strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_AZ_ONLY_HEADING_ROW-1,LCD_AZ_ONLY_HEADING_FIELD_SIZE); @@ -3374,7 +3438,18 @@ void update_display(){ strcpy(workstring,CCW_STRING); } strcat(workstring," "); - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + case AZ_DISPLAY_MODE_RAW: + dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + } + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + strcat(workstring,"+"); + } strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); } else { @@ -3463,7 +3538,18 @@ void update_display(){ strcat(workstring,CCW_STRING); } strcat(workstring," "); - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + switch(configuration.azimuth_display_mode){ + case AZ_DISPLAY_MODE_NORMAL: + case AZ_DISPLAY_MODE_OVERLAP_PLUS: + dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + case AZ_DISPLAY_MODE_RAW: + dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + break; + } + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + strcat(workstring,"+"); + } strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); row_override[LCD_STATUS_ROW] = 1; @@ -4070,6 +4156,8 @@ void read_settings_from_eeprom(){ debug.print(configuration.autopark_active); debug.print("autopark_time_minutes:"); debug.print(configuration.autopark_time_minutes); + debug.print("azimuth_display_mode:"); + debug.print(configuration.azimuth_display_mode); debug.println(""); } #endif // DEBUG_EEPROM @@ -4160,6 +4248,7 @@ void initialize_eeprom_with_defaults(){ configuration.clock_timezone_offset = 0; configuration.autopark_active = 0; configuration.autopark_time_minutes = 0; + configuration.azimuth_display_mode = AZ_DISPLAY_MODE_NORMAL; #ifdef FEATURE_ELEVATION_CONTROL configuration.last_elevation = elevation; @@ -10912,6 +11001,24 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte break; #endif + case '+': + if (configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS){ + configuration.azimuth_display_mode = AZ_DISPLAY_MODE_NORMAL; + strcpy(return_string, "Azimuth Display Mode: Normal"); + } else { + if (configuration.azimuth_display_mode == AZ_DISPLAY_MODE_RAW){ + configuration.azimuth_display_mode = AZ_DISPLAY_MODE_OVERLAP_PLUS; + strcpy(return_string, "Azimuth Display Mode: +Overlap"); + } else { + if (configuration.azimuth_display_mode == AZ_DISPLAY_MODE_NORMAL){ + configuration.azimuth_display_mode = AZ_DISPLAY_MODE_RAW; + strcpy(return_string, "Azimuth Display Mode: Raw Degrees"); + } + } + } + configuration_dirty = 1; + break; + // zzzzzzz // TODO : one big status query command diff --git a/k3ng_rotator_controller/rotator.h b/k3ng_rotator_controller/rotator.h index ec06357..b5df75b 100755 --- a/k3ng_rotator_controller/rotator.h +++ b/k3ng_rotator_controller/rotator.h @@ -163,5 +163,9 @@ #define AUTOCORRECT_WATCHING_AZ 3 #define AUTOCORRECT_WATCHING_EL 4 +#define AZ_DISPLAY_MODE_NORMAL 0 +#define AZ_DISPLAY_MODE_RAW 1 +#define AZ_DISPLAY_MODE_OVERLAP_PLUS 2 + /* ------end of macros ------- */ diff --git a/k3ng_rotator_controller/rotator_features_test.h b/k3ng_rotator_controller/rotator_features_test.h index eccd92d..941bd65 100755 --- a/k3ng_rotator_controller/rotator_features_test.h +++ b/k3ng_rotator_controller/rotator_features_test.h @@ -16,8 +16,8 @@ #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_MOON_TRACKING -#define FEATURE_SUN_TRACKING +// #define FEATURE_MOON_TRACKING +// #define FEATURE_SUN_TRACKING #define FEATURE_CLOCK #define FEATURE_GPS #define FEATURE_RTC_DS1307 @@ -133,16 +133,16 @@ // #define OPTION_DISPLAY_HHMM_CLOCK // display HH:MM clock (set position with #define LCD_HHMM_CLOCK_POSITION) // #define OPTION_DISPLAY_HHMMSS_CLOCK // display HH:MM:SS clock (set position with #define LCD_HHMMSS_CLOCK_POSITION) // #define OPTION_DISPLAY_ALT_HHMM_CLOCK_AND_MAIDENHEAD // display alternating HH:MM clock and maidenhead on LCD row 1 (set position with #define LCD_HHMMCLOCK_POSITION) -// #define OPTION_DISPLAY_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD // display constant HH:MM:SS clock and maidenhead on LCD row 1 (set position with #define LCD_CONSTANT_HHMMSSCLOCK_MAIDENHEAD_POSITION) -#define OPTION_DISPLAY_BIG_CLOCK // display date & time clock (set row with #define LCD_BIG_CLOCK_ROW) +#define OPTION_DISPLAY_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD // display constant HH:MM:SS clock and maidenhead on LCD row 1 (set position with #define LCD_CONSTANT_HHMMSSCLOCK_MAIDENHEAD_POSITION) +// #define OPTION_DISPLAY_BIG_CLOCK // display date & time clock (set row with #define LCD_BIG_CLOCK_ROW) //#define OPTION_CLOCK_ALWAYS_HAVE_HOUR_LEADING_ZERO #define OPTION_DISPLAY_GPS_INDICATOR // display GPS indicator on LCD - set position with LCD_GPS_INDICATOR_POSITION and LCD_GPS_INDICATOR_ROW -#define OPTION_DISPLAY_MOON_TRACKING_CONTINUOUSLY +// #define OPTION_DISPLAY_MOON_TRACKING_CONTINUOUSLY //#define OPTION_DISPLAY_DIRECTION_STATUS // N, W, E, S, NW, etc. direction indicator // #define OPTION_DISPLAY_SUN_TRACKING_CONTINUOUSLY //#define OPTION_DISPLAY_MOON_OR_SUN_TRACKING_CONDITIONAL #define OPTION_DISPLAY_VERSION_ON_STARTUP //code provided by Paolo, IT9IPQ -//#define OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE +#define OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE //#define FEATURE_POWER_SWITCH //#define OPTION_EXTERNAL_ANALOG_REFERENCE //Activate external analog voltage reference (needed for RemoteQTH.com unit) diff --git a/k3ng_rotator_controller/rotator_settings.h b/k3ng_rotator_controller/rotator_settings.h index 08d06bd..bef152d 100755 --- a/k3ng_rotator_controller/rotator_settings.h +++ b/k3ng_rotator_controller/rotator_settings.h @@ -153,7 +153,7 @@ You can tweak these, but read the online documentation! #define BRAKE_ACTIVE_STATE HIGH #define BRAKE_INACTIVE_STATE LOW -#define EEPROM_MAGIC_NUMBER 108 +#define EEPROM_MAGIC_NUMBER 109 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds diff --git a/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h b/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h index 5d38a08..d00551b 100755 --- a/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h +++ b/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h @@ -149,7 +149,7 @@ You can tweak these, but read the online documentation! #define BRAKE_ACTIVE_STATE HIGH #define BRAKE_INACTIVE_STATE LOW -#define EEPROM_MAGIC_NUMBER 108 +#define EEPROM_MAGIC_NUMBER 109 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds diff --git a/k3ng_rotator_controller/rotator_settings_m0upu.h b/k3ng_rotator_controller/rotator_settings_m0upu.h index 5d38a08..d00551b 100755 --- a/k3ng_rotator_controller/rotator_settings_m0upu.h +++ b/k3ng_rotator_controller/rotator_settings_m0upu.h @@ -149,7 +149,7 @@ You can tweak these, but read the online documentation! #define BRAKE_ACTIVE_STATE HIGH #define BRAKE_INACTIVE_STATE LOW -#define EEPROM_MAGIC_NUMBER 108 +#define EEPROM_MAGIC_NUMBER 109 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds diff --git a/k3ng_rotator_controller/rotator_settings_test.h b/k3ng_rotator_controller/rotator_settings_test.h index 9e11b61..2d5baab 100755 --- a/k3ng_rotator_controller/rotator_settings_test.h +++ b/k3ng_rotator_controller/rotator_settings_test.h @@ -163,7 +163,7 @@ You can tweak these, but read the online documentation! #define BRAKE_ACTIVE_STATE HIGH #define BRAKE_INACTIVE_STATE LOW -#define EEPROM_MAGIC_NUMBER 108 +#define EEPROM_MAGIC_NUMBER 109 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds diff --git a/k3ng_rotator_controller/rotator_settings_wb6kcn.h b/k3ng_rotator_controller/rotator_settings_wb6kcn.h index 6d3dede..8d2ea74 100755 --- a/k3ng_rotator_controller/rotator_settings_wb6kcn.h +++ b/k3ng_rotator_controller/rotator_settings_wb6kcn.h @@ -150,7 +150,7 @@ You can tweak these, but read the online documentation! #define BRAKE_ACTIVE_STATE HIGH #define BRAKE_INACTIVE_STATE LOW -#define EEPROM_MAGIC_NUMBER 108 +#define EEPROM_MAGIC_NUMBER 109 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds