2020.05.11.02

Added OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP which is disabled by default.  By default the controller will ignore at boot up GS-232 commands that start rotation or change the configuration.
        Related setting (new): ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000   (ignore commands the first 5 seconds after boot up)
This commit is contained in:
Anthony Good 2020-05-11 19:58:10 -04:00
parent 0f74085281
commit be47f2143f
11 changed files with 461 additions and 303 deletions

View File

@ -485,6 +485,10 @@
2020.05.11.01
Handle ARDUINO_AVR_MICRO having Serial port as Serial_ class and Serial1 as HardwareSerial class
2020.05.11.02
Added OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP which is disabled by default. By default the controller will ignore at boot up GS-232 commands that start rotation or change the configuration.
Related setting (new): ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000 (ignore commands the first 5 seconds after boot up)
All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc.
Anything rotator_*.* should be in the ino directory!
@ -497,7 +501,7 @@
*/
#define CODE_VERSION "2020.05.11.01"
#define CODE_VERSION "2020.05.11.02"
#include <avr/pgmspace.h>
#include <EEPROM.h>
@ -14581,9 +14585,11 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
strcat(return_string,"+0");
}
#endif
#ifdef OPTION_GS_232B_EMULATION
strcat(return_string,"EL=");
#endif
dtostrf(int(elevation / HEADING_MULTIPLIER),0,0,tempstring);
if (int(elevation / HEADING_MULTIPLIER) < 10) {
strcat(return_string,("0"));
@ -14624,11 +14630,12 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
}
#endif // DEBUG_PROCESS_YAESU
#ifdef FEATURE_ELEVATION_CONTROL
if ((yaesu_command_buffer[1] == '2') && (yaesu_command_buffer_index > 1)) { // did we get the F2 command?
clear_serial_buffer();
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
if (source_port == CONTROL_PORT0){
control_port->println(F("Elevate to 180 (or max elevation) and send keystroke..."));
}
@ -14637,11 +14644,26 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
configuration.analog_el_max_elevation = analog_el;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
if (source_port == CONTROL_PORT0){
control_port->println(F("Elevate to 180 (or max elevation) and send keystroke..."));
}
get_keystroke();
read_elevation(1);
configuration.analog_el_max_elevation = analog_el;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
}
#endif // OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP
return;
}
#endif
#endif //FEATURE_ELEVATION_CONTROL
clear_serial_buffer();
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
if (source_port == CONTROL_PORT0){
control_port->println(F("Rotate to full CW and send keystroke..."));
get_keystroke();
@ -14650,20 +14672,48 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
configuration.analog_az_full_cw = analog_az;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
if (source_port == CONTROL_PORT0){
control_port->println(F("Rotate to full CW and send keystroke..."));
get_keystroke();
}
read_azimuth(1);
configuration.analog_az_full_cw = analog_az;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
}
#endif // OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP
break;
#endif // FEATURE_AZ_POSITION_POTENTIOMETER
case 'H': print_help(source_port); break; // H - print help - depricated
case 'L': // L - manual left (CCW) rotation
#ifdef DEBUG_PROCESS_YAESU
if (debug_mode) {
debug.print("yaesu_serial_command: L\n");
}
#endif // DEBUG_PROCESS_YAESU
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
submit_request(AZ, REQUEST_CCW, 0, 21);
//strcpy(return_string,"\n");
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
submit_request(AZ, REQUEST_CCW, 0, 21);
//strcpy(return_string,"\n");
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
}
#endif //OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP
break;
#ifdef FEATURE_AZ_POSITION_POTENTIOMETER
@ -14677,6 +14727,8 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
#ifdef FEATURE_ELEVATION_CONTROL
if ((yaesu_command_buffer[1] == '2') && (yaesu_command_buffer_index > 1)) { // did we get the O2 command?
clear_serial_buffer();
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
if (source_port == CONTROL_PORT0){
control_port->println(F("Elevate to 0 degrees and send keystroke..."));
}
@ -14685,11 +14737,26 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
configuration.analog_el_0_degrees = analog_el;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
if (source_port == CONTROL_PORT0){
control_port->println(F("Elevate to 0 degrees and send keystroke..."));
}
get_keystroke();
read_elevation(1);
configuration.analog_el_0_degrees = analog_el;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
}
#endif //OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP
return;
}
#endif
#endif // FEATURE_ELEVATION_CONTROL
clear_serial_buffer();
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
if (source_port == CONTROL_PORT0){
control_port->println(F("Rotate to full CCW and send keystroke..."));
}
@ -14698,6 +14765,19 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
configuration.analog_az_full_ccw = analog_az;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
if (source_port == CONTROL_PORT0){
control_port->println(F("Rotate to full CCW and send keystroke..."));
}
get_keystroke();
read_azimuth(1);
configuration.analog_az_full_ccw = analog_az;
write_settings_to_eeprom();
strcpy(return_string,"Wrote to memory");
}
#endif
break;
#endif // FEATURE_AZ_POSITION_POTENTIOMETER
@ -14707,11 +14787,23 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
debug.print("yaesu_serial_command: R\n");
}
#endif // DEBUG_PROCESS_YAESU
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
submit_request(AZ, REQUEST_CW, 0, 22);
strcpy(return_string,"\n");
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
submit_request(AZ, REQUEST_CW, 0, 22);
strcpy(return_string,"\n");
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
}
#endif
break;
case 'A': // A - CW/CCW rotation stop
@ -14796,7 +14888,13 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
clear_timed_buffer();
#endif // FEATURE_TIMED_BUFFER
if ((parsed_value >= 0) && (parsed_value <= (azimuth_starting_point + azimuth_rotation_capability))) {
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
submit_request(AZ, REQUEST_AZIMUTH, (parsed_value * HEADING_MULTIPLIER), 28);
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
submit_request(AZ, REQUEST_AZIMUTH, (parsed_value * HEADING_MULTIPLIER), 28);
}
#endif
return;
}
}
@ -14820,7 +14918,13 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
#ifdef FEATURE_TIMED_BUFFER
case 'T': // T - initiate timed tracking
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
initiate_timed_buffer(source_port);
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
initiate_timed_buffer(source_port);
}
#endif
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
@ -14890,7 +14994,13 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
submit_request(EL, REQUEST_UP, 0, 29);
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
submit_request(EL, REQUEST_UP, 0, 29);
}
#endif
//strcpy(return_string,"\n");
break;
@ -14903,7 +15013,13 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
submit_request(EL, REQUEST_DOWN, 0, 30);
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
submit_request(EL, REQUEST_DOWN, 0, 30);
}
#endif
//strcpy(return_string,"\n");
break;
@ -14948,6 +15064,7 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
debug.print("yaesu_serial_command: W\n");
}
#endif // DEBUG_PROCESS_YAESU
#ifdef FEATURE_PARK
deactivate_park();
#endif // FEATURE_PARK
@ -15010,10 +15127,15 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
#else
if ((parsed_value >= 0) && (parsed_value <= ((azimuth_starting_point + azimuth_rotation_capability)* HEADING_MULTIPLIER)) && (parsed_elevation >= 0) && (parsed_elevation <= (ELEVATION_MAXIMUM_DEGREES * HEADING_MULTIPLIER))) {
//if ((parsed_value >= 0) && (parsed_value <= (360 * HEADING_MULTIPLIER)) && (parsed_elevation >= 0) && (parsed_elevation <= (180 * HEADING_MULTIPLIER))) {
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
submit_request(AZ, REQUEST_AZIMUTH, parsed_value, 33);
submit_request(EL, REQUEST_ELEVATION, parsed_elevation, 34);
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
submit_request(AZ, REQUEST_AZIMUTH, parsed_value, 33);
submit_request(EL, REQUEST_ELEVATION, parsed_elevation, 34);
}
#endif
} else {
#ifdef DEBUG_PROCESS_YAESU
if (debug_mode) {
@ -15029,7 +15151,7 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
#ifdef OPTION_GS_232B_EMULATION
case 'P': // P - switch between 360 and 450 degree mode
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
if ((yaesu_command_buffer[1] == '3') && (yaesu_command_buffer_index > 2)) { // P36 command
azimuth_rotation_capability = 360;
strcpy(return_string,"Mode 360 degree");
@ -15043,11 +15165,28 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
strcpy(return_string,"?>");
}
}
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
if ((yaesu_command_buffer[1] == '3') && (yaesu_command_buffer_index > 2)) { // P36 command
azimuth_rotation_capability = 360;
strcpy(return_string,"Mode 360 degree");
// write_settings_to_eeprom();
} else {
if ((yaesu_command_buffer[1] == '4') && (yaesu_command_buffer_index > 2)) { // P45 command
azimuth_rotation_capability = 450;
strcpy(return_string,"Mode 450 degree");
// write_settings_to_eeprom();
} else {
strcpy(return_string,"?>");
}
}
}
#endif
break;
case 'Z': // Z - Starting point toggle
#if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP)
if (azimuth_starting_point == 180) {
azimuth_starting_point = 0;
strcpy(return_string,"N");
@ -15056,7 +15195,19 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer
strcpy(return_string,"S");
}
strcat(return_string," Center");
// write_settings_to_eeprom();
#else
if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){
if (azimuth_starting_point == 180) {
azimuth_starting_point = 0;
strcpy(return_string,"N");
} else {
azimuth_starting_point = 180;
strcpy(return_string,"S");
}
strcat(return_string," Center");
}
#endif
break;
#endif

View File

@ -175,3 +175,4 @@
// #define OPTION_GPS_EXCLUDE_MISSING_LF_CR_HANDLING
// #define OPTION_MORE_SERIAL_CHECKS
// #define OPTION_STEPPER_MOTOR_USE_TIMER_ONE_INSTEAD_OF_FIVE
// #define OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP // if disabled, rotational and configuration commands will be ignored on the serial port for the first 10 second after boot up

View File

@ -57,3 +57,4 @@
//#define OPTION_GPS_EXCLUDE_MISSING_LF_CR_HANDLING
//#define OPTION_MORE_SERIAL_CHECKS
//#define OPTION_STEPPER_MOTOR_USE_TIMER_ONE_INSTEAD_OF_FIVE
//#define OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP // if disabled, rotational and configuration commands will be ignored on the serial port for the first 10 second after boot up

View File

@ -160,3 +160,4 @@
//#define OPTION_GPS_EXCLUDE_MISSING_LF_CR_HANDLING
//#define OPTION_MORE_SERIAL_CHECKS
//#define OPTION_STEPPER_MOTOR_USE_TIMER_ONE_INSTEAD_OF_FIVE
//#define OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP // if disabled, rotational and configuration commands will be ignored on the serial port for the first 10 second after boot up

View File

@ -112,7 +112,7 @@
#define OPTION_POSITION_PULSE_INPUT_PULLUPS // define to enable weak pullups on position pulse inputs
/* less often used features and options */
// #define OPTION_GS_232B_EMULATION // comment this out to default to Yaesu GS-232A emulation when using FEATURE_YAESU_EMULATION above
#define OPTION_GS_232B_EMULATION // comment this out to default to Yaesu GS-232A emulation when using FEATURE_YAESU_EMULATION above
#define FEATURE_ROTATION_INDICATOR_PIN // activate rotation_indication_pin to indicate rotation
// #define FEATURE_LIMIT_SENSE
// #define FEATURE_TIMED_BUFFER // Support for Yaesu timed buffer commands
@ -181,6 +181,7 @@
// #define OPTION_GPS_EXCLUDE_MISSING_LF_CR_HANDLING
// #define OPTION_MORE_SERIAL_CHECKS
#define OPTION_STEPPER_MOTOR_USE_TIMER_ONE_INSTEAD_OF_FIVE
// #define OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP // if disabled, rotational and configuration commands will be ignored on the serial port for the first 10 second after boot up
// ######## ######## ###### ########

View File

@ -152,13 +152,5 @@
//#define OPTION_GPS_EXCLUDE_MISSING_LF_CR_HANDLING
//#define OPTION_MORE_SERIAL_CHECKS
//#define OPTION_STEPPER_MOTOR_USE_TIMER_ONE_INSTEAD_OF_FIVE
// #define OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP // if disabled, rotational and configuration commands will be ignored on the serial port for the first 10 second after boot up
/*
Note:
Ham Radio Deluxe expects AZ and EL in output for Yaesu C command in AZ/EL mode. I'm not sure if this is default behavior for
the Yaesu interface since the C2 command is supposed to be for AZ and EL. If you have problems with other software with this code in AZ/EL mode,
uncomment #define OPTION_C_COMMAND_SENDS_AZ_AND_EL.
*/

View File

@ -356,3 +356,6 @@ You can tweak these, but read the online documentation!
#define nexSerial Serial3
#define NEXTION_SERIAL_BAUD 115200
#define ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000 // if OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP is enabled, ignore configuration and rotational command for this many mS after boot up

View File

@ -346,3 +346,5 @@ You can tweak these, but read the online documentation!
#define nexSerial Serial3
#define NEXTION_SERIAL_BAUD 115200
#define ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000 // if OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP is enabled, ignore configuration and rotational command for this many mS after boot up

View File

@ -346,3 +346,5 @@ You can tweak these, but read the online documentation!
#define nexSerial Serial3
#define NEXTION_SERIAL_BAUD 115200
#define ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000 // if OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP is enabled, ignore configuration and rotational command for this many mS after boot up

View File

@ -368,6 +368,8 @@ You can tweak these, but read the online documentation!
#define nexSerial Serial3
#define NEXTION_SERIAL_BAUD 115200
#define ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000 // if OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP is enabled, ignore configuration and rotational command for this many mS after boot up
// ######## ######## ###### ########
// ## ## ## ## ##

View File

@ -346,4 +346,6 @@ You can tweak these, but read the online documentation!
//#define SET_I2C_BUS_SPEED 800000L // Can set up to 800 kHz, depending on devices. 800000L = 800 khz, 400000L = 400 khz. Default is 100 khz
#define ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS 5000 // if OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP is enabled, ignore configuration and rotational command for this many mS after boot up