From ed576ee2a279f56ba6f0110487765198a47dd6f8 Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Mon, 23 Mar 2015 20:28:45 -0400 Subject: [PATCH] 2.0.2015032301 Updated for Arduino 1.6.1 --- k3ng_rotator_controller.ino | 25 ++++++++++++++++++++----- libraries/PCF8583.cpp | 3 ++- rotator_features_wb6kcn.h | 4 ++-- rotator_pins.h | 2 +- rotator_pins_wb6kcn.h | 2 ++ 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 21de453..f19ad94 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -263,7 +263,7 @@ Fixed compilation error when FEATURE_JOYSTICK_CONTROL is activated and FEATURE_ELEVATION_CONTROL is disabled - Not documented yet: + Not documented yet: --------------------------------------------------------------------------------------------- FEATURE_ANALOG_OUTPUT_PINS (rotator_features.h) FEATURE_AZ_POSITION_LSM303 is now FEATURE_AZ_POSITION_ADAFRUIT_LSM303 (rotator_features.h) @@ -338,9 +338,13 @@ OPTION_SYNC_MASTER_COORDINATES_TO_SLAVE + reset_pin + + Updated for Arduino 1.6.1 + */ -#define CODE_VERSION "2.0.2015031101" +#define CODE_VERSION "2.0.2015032301" #include #include @@ -1034,7 +1038,13 @@ void check_for_reset_flag(){ detected_reset_flag_time = millis(); } else { if ((millis()-detected_reset_flag_time) > 5000){ // let things run for 5 seconds - asm volatile ("jmp 0"); // reboot! + //wdt_enable(WDTO_30MS); while(1) {}; //doesn't work on Mega +//zzzzzz + #ifdef reset_pin + digitalWrite(reset_pin,HIGH); + #else // reset_pin + asm volatile (" jmp 0"); // reboot! // doesn't work on Arduino Mega but works on SainSmart Mega. + #endif //reset_pin } } } @@ -6112,6 +6122,11 @@ void initialize_interrupts(){ void initialize_pins(){ + #ifdef reset_pin + pinMode(reset_pin, OUTPUT); + digitalWrite(reset_pin, LOW); + #endif //reset_pin + if (serial_led) { pinModeEnhanced(serial_led, OUTPUT); } @@ -8180,7 +8195,7 @@ void service_remote_communications_incoming_buffer(){ if (remote_unit_command_submitted) { // this was a solicited response switch (remote_unit_command_submitted) { - case REMOTE_UNIT_RC_COMMAND: //zzzzzzzz //RC+40.9946 -075.6596 + case REMOTE_UNIT_RC_COMMAND: //RC+40.9946 -075.6596 if ((remote_unit_port_buffer[0] == 'R') && (remote_unit_port_buffer[1] == 'C') && (remote_unit_port_buffer[5] == '.') && (remote_unit_port_buffer[10] == ' ') && (remote_unit_port_buffer[15] == '.')){ temp_float_latitude = ((remote_unit_port_buffer[3]-48)*10) + (remote_unit_port_buffer[4]-48) + ((remote_unit_port_buffer[6]-48)/10.0) + ((remote_unit_port_buffer[7]-48)/100.0) + ((remote_unit_port_buffer[8]-48)/1000.0) + ((remote_unit_port_buffer[9]-48)/10000.0); if (remote_unit_port_buffer[2] == '-') { @@ -11804,7 +11819,7 @@ byte ethernet_slave_link_send(char * string_to_send){ #if defined(OPTION_SYNC_MASTER_COORDINATES_TO_SLAVE) && (defined(FEATURE_MASTER_WITH_SERIAL_SLAVE) || defined(FEATURE_MASTER_WITH_ETHERNET_SLAVE)) void sync_master_coordinates_to_slave(){ - static unsigned long last_sync_master_coordinates_to_slave = 10000; //zzzzzz + static unsigned long last_sync_master_coordinates_to_slave = 10000; if ((millis() - last_sync_master_coordinates_to_slave) >= (SYNC_MASTER_COORDINATES_TO_SLAVE_SECS * 1000)){ if (submit_remote_command(REMOTE_UNIT_RC_COMMAND, 0, 0)) { diff --git a/libraries/PCF8583.cpp b/libraries/PCF8583.cpp index e605f58..6aedae1 100755 --- a/libraries/PCF8583.cpp +++ b/libraries/PCF8583.cpp @@ -36,7 +36,8 @@ namespace { } byte DayOfWeek(const PCF8583 &now) { - static char PROGMEM MonthTable[24] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5, -1, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}; + //static char PROGMEM MonthTable[24] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5, -1, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}; + const char PROGMEM MonthTable[24] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5, -1, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}; // modified by Anthony Good 2015-03-23 for compilation under Arduino 1.6.1 byte y = now.year % 100, c = 6 - 2 * ((now.year / 100) % 4); return (now.day + pgm_read_byte_near(MonthTable + IsLeapYear(now.year) * 12 + now.month - 1) + y + (y / 4) + c) % 7; } diff --git a/rotator_features_wb6kcn.h b/rotator_features_wb6kcn.h index fd6f17f..f81da3d 100644 --- a/rotator_features_wb6kcn.h +++ b/rotator_features_wb6kcn.h @@ -17,7 +17,7 @@ //#define FEATURE_RTC_DS1307 //#define FEATURE_RTC_PCF8583 //#define FEATURE_ETHERNET -//#define FEATURE_STEPPER_MOTOR // requires this library: https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation +#define FEATURE_STEPPER_MOTOR // requires this library: https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation //#define FEATURE_AUTOCORRECT #define LANGUAGE_ENGLISH @@ -29,7 +29,7 @@ //#define FEATURE_REMOTE_UNIT_SLAVE // uncomment this to make this unit a remote unit controlled by a host unit -#define FEATURE_MASTER_WITH_SERIAL_SLAVE // [master]{remote_port}<-------serial-------->{control_port}[slave] +//#define FEATURE_MASTER_WITH_SERIAL_SLAVE // [master]{remote_port}<-------serial-------->{control_port}[slave] //#define FEATURE_MASTER_WITH_ETHERNET_SLAVE // [master]<-------------------ethernet--------------------->[slave] diff --git a/rotator_pins.h b/rotator_pins.h index 57c7297..250fd67 100644 --- a/rotator_pins.h +++ b/rotator_pins.h @@ -192,5 +192,5 @@ #define pin_moon_pushbutton_calibration 0 // normally HIGH, have button pull LOW #endif //FEATURE_MOON_PUSHBUTTON_AZ_EL_CALIBRATION - +//#define reset_pin 22 // if defined, goes HIGH to reset unit diff --git a/rotator_pins_wb6kcn.h b/rotator_pins_wb6kcn.h index d250b24..93720d6 100755 --- a/rotator_pins_wb6kcn.h +++ b/rotator_pins_wb6kcn.h @@ -183,5 +183,7 @@ #define pin_analog_el_out 0 #endif //FEATURE_ANALOG_OUTPUT_PINS +//#define reset_pin 22 // if defined, goes HIGH to reset unit +