diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 009ca56..0185ed1 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -17,7 +17,7 @@ Testing, ideas, bug fixes, and hardware provided by Anthony M0UPU, Bent OZ1CT, Eric WB6KCN, Norm N3YKF, Jan OK2ZAW, Jim M0CKE, Paolo IT9IPQ, and many others - Translations: Maximo EA1DDO, Jan OK2ZAW, Paolo IT9IPQ + Translations: Maximo EA1DDO, Jan OK2ZAW, Paolo IT9IPQ, Ismael PY4PI Pololu library LSM303 code provided by Mike AD0CZ @@ -271,10 +271,16 @@ Fixed bug with LANGUAGE_CZECH (thanks Radek, OK2NMA) Change in Easycom response terminator (now uses whatever command terminator was sent to it) + Easycom AZ EL command string response change to +xxx.xx +xxx.xx + + OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK + LANGUAGE_PORTUGUESE_BRASIL (thanks Ismael, PY4PI) + + check_brake_release() bug fix */ -#define CODE_VERSION "2.0.2014110401" +#define CODE_VERSION "2.0.2014111701" #include #include @@ -1502,7 +1508,9 @@ void check_brake_release() { } } - #ifdef FEATURE_ELEVATION_CONTROL + if ((az_state != IDLE) && (brake_az_engaged)) {in_az_brake_release_delay = 0;} + + #ifdef FEATURE_ELEVATION_CONTROL if ((el_state == IDLE) && (brake_el_engaged)) { if (in_el_brake_release_delay) { if ((millis() - el_brake_delay_start_time) > EL_BRAKE_DELAY) { @@ -1514,7 +1522,9 @@ void check_brake_release() { in_el_brake_release_delay = 1; } } - #endif // FEATURE_ELEVATION_CONTROL + + if ((el_state != IDLE) && (brake_el_engaged)) {in_el_brake_release_delay = 0;} + #endif // FEATURE_ELEVATION_CONTROL } /* check_brake_release */ @@ -2063,12 +2073,46 @@ void check_serial(){ // if it is an Easycom command and we have a space, line feed, or carriage return, process it if (((incoming_serial_byte == 10) || (incoming_serial_byte == 13) || (incoming_serial_byte == 32)) && (control_port_buffer[0] != '\\') && (control_port_buffer[0] != '/')){ + #if defined(OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK) && defined(FEATURE_ELEVATION_CONTROL) + if ((control_port_buffer[0]=='A') && (control_port_buffer[1]=='Z') && (control_port_buffer_index == 2)){ + unsigned long start_time_hack = millis(); + if (!control_port->available()){ + while (((millis() - start_time_hack) < 200) && (!control_port->available())){} // wait 200 mS for something else to pop up on the serial port + } + if (control_port->available()){ // is there also 'EL ' waiting for us in the buffer? + start_time_hack = millis(); + while ( (control_port->available()) && ((millis() - start_time_hack) < 200) ) { + control_port->read(); + } + control_port_buffer[0] = 'Z'; + process_easycom_command(control_port_buffer,1,CONTROL_PORT0,return_string); + //control_port->println(return_string); zzzzzz + control_port->print(return_string); + control_port->write(incoming_serial_byte); + } else { // we got just a bare AZ command + process_easycom_command(control_port_buffer,control_port_buffer_index,CONTROL_PORT0,return_string); + //control_port->println(return_string); zzzzzz + control_port->print(return_string); + control_port->write(incoming_serial_byte); + } + } else { + + if (control_port_buffer_index > 1){ + process_easycom_command(control_port_buffer,control_port_buffer_index,CONTROL_PORT0,return_string); + //control_port->println(return_string); zzzzzz + control_port->print(return_string); + control_port->write(incoming_serial_byte); + } + + } + #else //defined(OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK) && defined(FEATURE_ELEVATION_CONTROL) if (control_port_buffer_index > 1){ process_easycom_command(control_port_buffer,control_port_buffer_index,CONTROL_PORT0,return_string); //control_port->println(return_string); zzzzzz control_port->print(return_string); control_port->write(incoming_serial_byte); } + #endif //defined(OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK) && defined(FEATURE_ELEVATION_CONTROL) clear_command_buffer(); } else { // if it is a backslash command, process it if we have a carriage return @@ -2183,7 +2227,7 @@ void check_buttons(){ debug_println("check_buttons: button_cw pushed"); #endif // DEBUG_BUTTONS #ifdef OPTION_AZ_MANUAL_ROTATE_LIMITS - if (raw_azimuth < (AZ_MANUAL_ROTATE_CW_LIMIT * HEADING_MULTIPLIER)) { + if (raw_azimuth < (AZ_MANUAL_ROTATE_CW_LIMIT * HEADING_MULTIPLIER)) { #endif submit_request(AZ, REQUEST_CW, 0, 61); azimuth_button_was_pushed = 1; @@ -10770,12 +10814,27 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ strcpy(return_string,""); switch (easycom_command_buffer[0]) { // look at the first character of the command + #if defined(OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK) && defined(FEATURE_ELEVATION_CONTROL) //zzzzzz + case 'Z': + strcpy(return_string,"+"); + dtostrf((float)azimuth/(float)HEADING_MULTIPLIER,0,1,tempstring); + strcat(return_string,tempstring); + if (elevation >= 0){ + strcat(return_string,"+"); + } else { + strcat(return_string,"-"); + } + dtostrf((float)elevation/(float)HEADING_MULTIPLIER,0,1,tempstring); + strcat(return_string,tempstring); + break; + #endif //OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK case 'A': // AZ if (easycom_command_buffer[1] == 'Z') { // format is AZx.x or AZxx.x or AZxxx.x (why didn't they make it fixed length?) switch (easycom_command_buffer_index) { #ifdef OPTION_EASYCOM_AZ_QUERY_COMMAND case 2: - strcpy(return_string,"AZ"); + //strcpy(return_string,"AZ"); + strcpy(return_string,"+"); dtostrf((float)azimuth/(float)HEADING_MULTIPLIER,0,1,tempstring); strcat(return_string,tempstring); return; @@ -10807,7 +10866,12 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ switch (easycom_command_buffer_index) { #ifdef OPTION_EASYCOM_EL_QUERY_COMMAND case 2: - strcpy(return_string,"EL"); + //strcpy(return_string,"EL"); + if (elevation >= 0){ + strcpy(return_string,"+"); + } else { + strcpy(return_string,"-"); + } dtostrf((float)elevation/(float)HEADING_MULTIPLIER,0,1,tempstring); strcat(return_string,tempstring); return; diff --git a/rotator_features.h b/rotator_features.h index e468f3f..a6237ff 100644 --- a/rotator_features.h +++ b/rotator_features.h @@ -24,6 +24,7 @@ //#define LANGUAGE_SPANISH //#define LANGUAGE_CZECH //#define LANGUAGE_ITALIAN +//#define LANGUAGE_PORTUGUESE_BRASIL /* master and remote slave unit functionality */ //#define FEATURE_REMOTE_UNIT_SLAVE // uncomment this to make this unit a remote unit controlled by a host unit @@ -44,7 +45,7 @@ //#define FEATURE_AZ_POSITION_HH12_AS5045_SSI //#define FEATURE_AZ_POSITION_INCREMENTAL_ENCODER -//#define FEATURE_EL_POSITION_POTENTIOMETER +#define FEATURE_EL_POSITION_POTENTIOMETER //#define FEATURE_EL_POSITION_ROTARY_ENCODER //#define FEATURE_EL_POSITION_PULSE_INPUT //#define FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB // Uncomment for elevation ADXL345 accelerometer support using ADXL345 library @@ -122,6 +123,7 @@ //#define OPTION_EXTERNAL_ANALOG_REFERENCE //Activate external analog voltage reference (needed for RemoteQTH.com unit) //#define OPTION_SYNC_MASTER_CLOCK_TO_SLAVE //#define OPTION_DISABLE_HMC5883L_ERROR_CHECKING +//#define OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK diff --git a/rotator_settings.h b/rotator_settings.h index 86f5e80..806fa65 100644 --- a/rotator_settings.h +++ b/rotator_settings.h @@ -369,6 +369,48 @@ You can tweak these, but read the online documentation! #define NNE_STRING "NNE" #endif //LANGUAGE_ITALIAN +#ifdef LANGUAGE_PORTUGUESE_BRASIL // courtesy of Ismael, PY4PI +#define MOON_STRING "lua " +#define SUN_STRING "sol " +#define AZ_TARGET_STRING "Objetivo Az " +#define EL_TARGET_STRING "Objetivo El " +#define TARGET_STRING "Objetivo " +#define PARKED_STRING "Estacionado" +#define ROTATING_CW_STRING "Rodando DIR" +#define ROTATING_CCW_STRING "Rodando ESQ" +#define ROTATING_TO_STRING "Rodando para " +#define ELEVATING_TO_STRING "Elevando para " +#define ELEVATING_UP_STRING "Subindo" +#define ELEVATING_DOWN_STRING "Descendo" +#define ROTATING_STRING "Rodando " +#define CW_STRING "DIR" +#define CCW_STRING "ESQ" +#define UP_STRING "SOBE" +#define DOWN_STRING "DESCE" +#define AZIMUTH_STRING "Azimute " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "O" +#define S_STRING "S" +#define E_STRING "L" +#define NW_STRING "NO" +#define SW_STRING "SO" +#define SE_STRING "SL" +#define NE_STRING "NL" +#define NNW_STRING "NNO" +#define WNW_STRING "ONO" +#define WSW_STRING "OSO" +#define SSW_STRING "SSO" +#define SSE_STRING "SSL" +#define ESE_STRING "LSL" +#define ENE_STRING "LNL" +#define NNE_STRING "NNL" +#endif //LANGUAGE_PORTUGUESE_BRASIL + #define TRACKING_ACTIVE_CHAR "*" #define TRACKING_INACTIVE_CHAR "-"