From 0f74085281080c6c76aa8d905911deda759aff53 Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Mon, 11 May 2020 17:31:05 -0400 Subject: [PATCH] 2020.05.11.01 Handle ARDUINO_AVR_MICRO having Serial port as Serial_ class and Serial1 as HardwareSerial class --- .../k3ng_rotator_controller.ino | 37 ++++++++++++++----- k3ng_rotator_controller/rotator_hardware.h | 5 ++- .../rotator_settings_test.h | 6 ++- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/k3ng_rotator_controller/k3ng_rotator_controller.ino b/k3ng_rotator_controller/k3ng_rotator_controller.ino index 8698d22..0b02c1f 100644 --- a/k3ng_rotator_controller/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller/k3ng_rotator_controller.ino @@ -482,6 +482,10 @@ 2020.05.08.01 Made improvement to rotator_k3ngdisplay.cpp to reduce LCD bus traffic from cursor positioning + 2020.05.11.01 + Handle ARDUINO_AVR_MICRO having Serial port as Serial_ class and Serial1 as HardwareSerial class + + All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. Anything rotator_*.* should be in the ino directory! @@ -493,7 +497,7 @@ */ -#define CODE_VERSION "2020.05.08.01" +#define CODE_VERSION "2020.05.11.01" #include #include @@ -933,16 +937,31 @@ byte current_az_speed_voltage = 0; SERIAL_PORT_CLASS * control_port; #endif -#if defined(FEATURE_MASTER_WITH_SERIAL_SLAVE) - SERIAL_PORT_CLASS * remote_unit_port; +#if !defined(ARDUINO_AVR_MICRO) + #if defined(FEATURE_MASTER_WITH_SERIAL_SLAVE) + SERIAL_PORT_CLASS * remote_unit_port; + #endif +#else + #if defined(FEATURE_MASTER_WITH_SERIAL_SLAVE) + SERIAL_PORT_CLASS_SECONDARY * remote_unit_port; + #endif #endif -#if defined(FEATURE_GPS) - SERIAL_PORT_CLASS * gps_port; - #ifdef GPS_MIRROR_PORT - SERIAL_PORT_CLASS * (gps_mirror_port); - #endif //GPS_MIRROR_PORT -#endif //defined(FEATURE_GPS) +#if !defined(ARDUINO_AVR_MICRO) + #if defined(FEATURE_GPS) + SERIAL_PORT_CLASS * gps_port; + #ifdef GPS_MIRROR_PORT + SERIAL_PORT_CLASS * (gps_mirror_port); + #endif //GPS_MIRROR_PORT + #endif //defined(FEATURE_GPS) +#else + #if defined(FEATURE_GPS) + SERIAL_PORT_CLASS_SECONDARY * gps_port; + #ifdef GPS_MIRROR_PORT + SERIAL_PORT_CLASS_SECONDARY * (gps_mirror_port); + #endif //GPS_MIRROR_PORT + #endif //defined(FEATURE_GPS) +#endif #if defined(FEATURE_MOON_TRACKING) || defined(FEATURE_SUN_TRACKING) || defined(FEATURE_CLOCK) || defined(FEATURE_GPS) || defined(FEATURE_REMOTE_UNIT_SLAVE) || defined(OPTION_DISPLAY_ALT_HHMM_CLOCK_AND_MAIDENHEAD) || defined(OPTION_DISPLAY_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD) diff --git a/k3ng_rotator_controller/rotator_hardware.h b/k3ng_rotator_controller/rotator_hardware.h index 2cfc849..aa16324 100755 --- a/k3ng_rotator_controller/rotator_hardware.h +++ b/k3ng_rotator_controller/rotator_hardware.h @@ -21,7 +21,10 @@ #if defined(ARDUINO_MAPLE_MINI) #define SERIAL_PORT_CLASS USBSerial -#elif defined(ARDUINO_AVR_PROMICRO) || defined(ARDUINO_AVR_LEONARDO) || defined(ARDUINO_AVR_MICRO) || defined(ARDUINO_AVR_YUN) || defined(ARDUINO_AVR_ESPLORA) || defined(ARDUINO_AVR_LILYPAD_USB) || defined(ARDUINO_AVR_ROBOT_CONTROL) || defined(ARDUINO_AVR_ROBOT_MOTOR) || defined(ARDUINO_AVR_LEONARDO_ETH) +#elif defined(ARDUINO_AVR_MICRO) + #define SERIAL_PORT_CLASS Serial_ + #define SERIAL_PORT_CLASS_SECONDARY HardwareSerial +#elif defined(ARDUINO_AVR_PROMICRO) || defined(ARDUINO_AVR_LEONARDO) || defined(ARDUINO_AVR_YUN) || defined(ARDUINO_AVR_ESPLORA) || defined(ARDUINO_AVR_LILYPAD_USB) || defined(ARDUINO_AVR_ROBOT_CONTROL) || defined(ARDUINO_AVR_ROBOT_MOTOR) || defined(ARDUINO_AVR_LEONARDO_ETH) #define SERIAL_PORT_CLASS Serial_ #elif defined(TEENSYDUINO) #define SERIAL_PORT_CLASS usb_serial_class diff --git a/k3ng_rotator_controller/rotator_settings_test.h b/k3ng_rotator_controller/rotator_settings_test.h index 6a65f06..dd0371e 100755 --- a/k3ng_rotator_controller/rotator_settings_test.h +++ b/k3ng_rotator_controller/rotator_settings_test.h @@ -121,7 +121,11 @@ You can tweak these, but read the online documentation! #define GPS_MIRROR_PORT_BAUD_RATE 9600 #define CONTROL_PORT_MAPPED_TO &Serial // change this line to map the control port to a different serial port (Serial1, Serial2, etc.) #define REMOTE_PORT_MAPPED_TO &Serial3 // change this line to map the remote_unit port to a different serial port -#define GPS_PORT_MAPPED_TO &Serial2 // change this line to map the GPS port to a different serial port +#if !defined(ARDUINO_AVR_MICRO) + #define GPS_PORT_MAPPED_TO &Serial2 // change this line to map the GPS port to a different serial port +#else + #define GPS_PORT_MAPPED_TO &Serial1 +#endif //#define GPS_MIRROR_PORT &Serial1 //3 // use this to mirror output from a GPS unit into the Arduino out another port (uncomment to enable) #define OPTION_SEND_STRING_OUT_CONTROL_PORT_WHEN_INITIALIZING_STRING ("test\n\r")