diff --git a/k3ng_rotator_controller/k3ng_rotator_controller.ino b/k3ng_rotator_controller/k3ng_rotator_controller.ino index 108ca6a..380ed17 100644 --- a/k3ng_rotator_controller/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller/k3ng_rotator_controller.ino @@ -456,7 +456,7 @@ */ -#define CODE_VERSION "2020.04.03.01" +#define CODE_VERSION "2020.04.06.01" #include #include @@ -626,6 +626,10 @@ #include "Nextion.h" #endif +#ifdef FEATURE_NEXTION_DISPLAY_2 + #include "Nextion.h" +#endif + #include "rotator_language.h" #include "rotator_debug.h" #include "rotator_debug_log_activation.h" @@ -1134,9 +1138,14 @@ DebugClass debug; #ifdef FEATURE_NEXTION_DISPLAY #include "rotator_nextion.h" - byte nextion_current_screen = NEXTION_PAGE_MAIN_ID; + byte nextion_current_screen = NEXTION_PAGE_SPLASH; #endif +#ifdef FEATURE_NEXTION_DISPLAY_2 + #include "rotator_nextion_api.h" +#endif + + /* ------------------ let's start doing some stuff now that we got the formalities out of the way --------------------*/ void setup() { @@ -3776,141 +3785,151 @@ void NextionbDownPushCallback(void *ptr) { // button press // -------------------------------------------------------------- #if defined(FEATURE_NEXTION_DISPLAY) void NextionbBackPageMainPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_ABOUT_ID); - + NextionPageRefresh(NEXTION_PAGE_ABOUT_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbNextPageMainPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_CONFIGURATION_ID); - + NextionPageRefresh(NEXTION_PAGE_CONFIGURATION_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbBackPageConfigurationPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_MAIN_ID); - + NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED); } -#endif - - -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbNextPageConfigurationPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_DIAGNOSTICS_ID); - + NextionPageRefresh(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbBackPageDiagnosticsPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_CONFIGURATION_ID); - + NextionPageRefresh(NEXTION_PAGE_CONFIGURATION_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbNextPageDiagnosticsPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_ABOUT_ID); - + NextionPageRefresh(NEXTION_PAGE_ABOUT_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbBackPageAboutPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_DIAGNOSTICS_ID); - + NextionPageRefresh(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbNextPageAboutPushCallback(void *ptr){ - - NextionPageRefresh(NEXTION_PAGE_MAIN_ID); - + NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) +void NextionbBackPageSecondaryPushCallback(void *ptr){ + NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED); +} +void NextionbNextPageSecondaryPushCallback(void *ptr){ + NextionPageRefresh(NEXTION_PAGE_TERTIARY, NEXTION_UNDEFINED); +} +void NextionbBackPageTertiaryPushCallback(void *ptr){ + NextionPageRefresh(NEXTION_PAGE_SECONDARY, NEXTION_UNDEFINED); +} +void NextionbNextPageTertiaryPushCallback(void *ptr){ + NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED); +} + + void NextionbDataEntryCancelPushCallback(void *ptr){ - - // TODO: Processing of Data Entry Cancel - - NextionPageRefresh(NEXTION_PAGE_MAIN_ID); - - + NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextionbDataEntryEnterPushCallback(void *ptr){ + float entered_data_float = 0; + uint32_t data_entry_mode = NEXTION_UNDEFINED; + uint32_t decimal_position = 99; + uint32_t entry_value = 0; + byte request_type = REQUEST_STOP; + byte request_axis = 0; + uint32_t text_entered_length = 0; - // TODO: Processing of Data Entry Enter + #if defined(DEBUG_NEXTION_DISPLAY) + debug.print("NextionbDataEntryEnterPushCallback: data_entry_mode: "); + #endif - NextionPageRefresh(NEXTION_PAGE_MAIN_ID); + //get the values from the page + vDataEntryMode.getValue(&data_entry_mode); + vDataEntrySeperatorEntered.getValue(&decimal_position); + vDataEntryValue.getValue(&entry_value); + //tDataEntryEntry.getText(dummy_buffer,dummy_length); // couldn't get this to work for deriving entry length + vDataEntryDataEntryLength.getValue(&text_entered_length); + + #if defined(DEBUG_NEXTION_DISPLAY) + debug.print("NextionbDataEntryEnterPushCallback: data_entry_mode: "); + #endif + + if (data_entry_mode == NEXTION_DATA_ENTRY_MODE_AZ){ + request_type = REQUEST_AZIMUTH; + request_axis = AZ; + #if defined(DEBUG_NEXTION_DISPLAY) + debug.print("NEXTION_DATA_ENTRY_MODE_AZ "); + #endif + } + + #if defined(FEATURE_ELEVATION_CONTROL) + if (data_entry_mode == NEXTION_DATA_ENTRY_MODE_EL){ + request_type = REQUEST_ELEVATION; + request_axis = EL; + #if defined(DEBUG_NEXTION_DISPLAY) + debug.print("NEXTION_DATA_ENTRY_MODE_EL "); + #endif + } + #endif + + #if defined(DEBUG_NEXTION_DISPLAY) + debug.print("sep: "); + debug.print(decimal_position); + debug.print(" val: "); + debug.print(entry_value); + debug.print(" len: "); + debug.print(text_entered_length); + debug.println(""); + #endif + + if (request_type != REQUEST_STOP){ + entered_data_float = entry_value; + if (decimal_position != 99){ // 99 == no decimal place - do nothing + entered_data_float = entered_data_float / pow(10,(text_entered_length - decimal_position)); + #if defined(DEBUG_NEXTION_DISPLAY) + debug.print("NextionbDataEntryEnterPushCallback: entered_data_float: "); + debug.println(entered_data_float); + #endif + } + // TODO: az / el validation + submit_request(request_axis, request_type, int(entered_data_float * HEADING_MULTIPLIER), DBG_NEXTION_DATA_ENT_ENTER_PUSH_CALLBK); + } + + + // go back to the main page + NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextiontAzValuePushCallback(void *ptr){ - - // TODO: setup screen for azimuth entry - - NextionPageRefresh(NEXTION_PAGE_DATA_ENTRY); - - + NextionPageRefresh(NEXTION_PAGE_DATA_ENTRY,NEXTION_DATA_ENTRY_MODE_AZ); } -#endif -// -------------------------------------------------------------- -#if defined(FEATURE_NEXTION_DISPLAY) void NextiontElValuePushCallback(void *ptr){ - - // TODO: setup screen for elevation entry - - NextionPageRefresh(NEXTION_PAGE_DATA_ENTRY); - + NextionPageRefresh(NEXTION_PAGE_DATA_ENTRY,NEXTION_DATA_ENTRY_MODE_EL); } + +void NextiontAzLabelPushCallback(void *ptr){ + NextionPageRefresh(NEXTION_PAGE_SECONDARY,NEXTION_UNDEFINED); +} +void NextiontElLabelPushCallback(void *ptr){ + NextionPageRefresh(NEXTION_PAGE_SECONDARY,NEXTION_UNDEFINED); +} + #endif // -------------------------------------------------------------- #if defined(FEATURE_NEXTION_DISPLAY) -void NextionPageRefresh(byte page_id){ +void NextionPageRefresh(byte page_id,byte other_information){ - + // load up pages and populate as appropriate switch (page_id){ case NEXTION_PAGE_MAIN_ID: pageMain.show(); - tTitle.setText(TOUCH_DISPLAY_TITLE); - tAzLabel.setText(AZIMUTH_STRING_NO_SPACE); + #if defined(FEATURE_ELEVATION_CONTROL) tElLabel.setText(ELEVATION_STRING_NO_SPACE); + timerAzEl.enable(); + #else + timerAzOnly.enable(); // this runs code on the display that makes elevation related objects disappear #endif - // Make the Up and Down buttons disappear if they're defined but we're azimuth onluy - #if !defined(FEATURE_ELEVATION_CONTROL) && defined(NEXTION_OBJNAME_BUTTON_DOWN) && defined(NEXTION_OBJID_BUTTON_DOWN) - bDown.Set_background_color_bco(NEXTION_OBJECT_DISABLE_COLOR); - bDown.Set_press_background_color_bco2(NEXTION_OBJECT_DISABLE_COLOR); - bDown.Set_font_color_pco(NEXTION_OBJECT_DISABLE_COLOR); - bDown.Set_press_font_color_pco2(NEXTION_OBJECT_DISABLE_COLOR); - #endif - #if !defined(FEATURE_ELEVATION_CONTROL) && defined(NEXTION_OBJNAME_BUTTON_UP) && defined(NEXTION_OBJID_BUTTON_UP) - bUp.Set_background_color_bco(NEXTION_OBJECT_DISABLE_COLOR); - bUp.Set_press_background_color_bco2(NEXTION_OBJECT_DISABLE_COLOR); - bUp.Set_font_color_pco(NEXTION_OBJECT_DISABLE_COLOR); - bUp.Set_press_font_color_pco2(NEXTION_OBJECT_DISABLE_COLOR); - #endif - + tTitle.setText(TOUCH_DISPLAY_TITLE); + tAzLabel.setText(AZIMUTH_STRING_NO_SPACE); bCW.setText(CW_STRING); bCCW.setText(CCW_STRING); @@ -3942,6 +3961,25 @@ void NextionPageRefresh(byte page_id){ bDataEntryEnter.setText(TOUCH_DISPLAY_DATA_ENTRY_ENTER); bDataEntryDelete.setText(TOUCH_DISPLAY_DATA_ENTRY_DELETE); bDataEntrySeperator.setText(TOUCH_DISPLAY_DATA_ENTRY_SEPERATOR); + vDataEntryMode.setValue(other_information); // the data entry mode (az or el) gets passed to a Nextion global variable + switch(other_information){ + case NEXTION_DATA_ENTRY_MODE_AZ: + tDataEntryTitle.setText(TOUCH_DISPLAY_ENTER_AZ); + break; + case NEXTION_DATA_ENTRY_MODE_EL: + tDataEntryTitle.setText(TOUCH_DISPLAY_ENTER_EL); + break; + } + break; + + case NEXTION_PAGE_SECONDARY: + pageSecondary.show(); + //tTitleSecondary.setText(TOUCH_DISPLAY_TITLE); + break; + + case NEXTION_PAGE_TERTIARY: + pageTertiary.show(); + //tTitleTertiary.setText(TOUCH_DISPLAY_TITLE); break; } @@ -3957,17 +3995,18 @@ void service_nextion_display(){ TODO: - Preset Encoder Status ? - Park Status - Moon & Sun (Buttons, another Page?) - PARK Buttons Azimuth & Elevation Data Entry in Display Azimuth Direction - New Pages + Pages + Secondary + Presets + Park Button + Long path + Moon + Sun Data Entry Configuration - Moon & Sun? Event Log? Diagnostics Serial Sniff? @@ -3982,6 +4021,7 @@ void service_nextion_display(){ static int last_azimuth = 0; static unsigned long last_az_update = 0; static byte last_nextion_current_screen = NEXTION_PAGE_MAIN_ID; + static byte unloaded_splash_screen = 0; #if defined(FEATURE_ELEVATION_CONTROL) static int last_elevation = 0; @@ -4026,6 +4066,11 @@ void service_nextion_display(){ static unsigned long last_status3_update = 0; #endif + if ((!unloaded_splash_screen) && (millis()>3000)){ + NextionPageRefresh(NEXTION_PAGE_MAIN_ID,NEXTION_UNDEFINED); + unloaded_splash_screen = 1; + } + nexLoop(nex_listen_list); // Main Page @@ -4118,17 +4163,20 @@ void service_nextion_display(){ //COORDINATES #if defined(FEATURE_GPS) && defined(NEXTION_OBJNAME_COORDINATES) && defined(NEXTION_OBJID_COORDINATES) if (((millis() - last_coord_update) > 5100) || (last_nextion_current_screen != nextion_current_screen)){ - - gps.f_get_position(&gps_lat_temp,&gps_long_temp,&gps_fix_age_temp); - dtostrf(gps_lat_temp,4,4,workstring1); - strcat(workstring1," "); - dtostrf(gps_long_temp,4,4,workstring2); - strcat(workstring1,workstring2); - strcat(workstring1," "); - dtostrf(gps.altitude()/100,0,0,workstring2); - strcat(workstring1,workstring2); - strcat(workstring1,"m"); - tCoordinates.setText(workstring1); + if ((clock_status == GPS_SYNC) || (clock_status == SLAVE_SYNC_GPS)) { + gps.f_get_position(&gps_lat_temp,&gps_long_temp,&gps_fix_age_temp); + dtostrf(gps_lat_temp,4,4,workstring1); + strcat(workstring1," "); + dtostrf(gps_long_temp,4,4,workstring2); + strcat(workstring1,workstring2); + strcat(workstring1," "); + dtostrf(gps.altitude()/100,0,0,workstring2); + strcat(workstring1,workstring2); + strcat(workstring1,"m"); + tCoordinates.setText(workstring1); + } else { + tCoordinates.setText(""); + } last_coord_update = millis(); } #endif @@ -8385,8 +8433,9 @@ void initialize_peripherals(){ #ifdef FEATURE_NEXTION_DISPLAY nexInit(); - NextionPageRefresh(NEXTION_PAGE_MAIN_ID); + timerInvokeReset.enable(); // manually invoke a hardware reset - this is to fix issues with data entry page + // Register events #if defined(NEXTION_OBJNAME_BUTTON_CW) && defined(NEXTION_OBJID_BUTTON_CW) bCW.attachPush(NextionbCWPushCallback, &bCW); @@ -8399,11 +8448,9 @@ void initialize_peripherals(){ bSTOP.attachPop(NextionbSTOPPushAndPopCallback, &bSTOP); #endif - // Azimuth Value Press (go to data entry page) - #if defined(NEXTION_OBJNAME_AZIMUTH_VALUE) && defined(NEXTION_OBJID_AZIMUTH_VALUE) - tAzValue.attachPush(NextiontAzValuePushCallback, &tAzValue); - #endif - + // Azimuth Value Press (go to data entry page) + tAzValue.attachPush(NextiontAzValuePushCallback, &tAzValue); + #if defined(FEATURE_ELEVATION_CONTROL) #if defined(NEXTION_OBJNAME_BUTTON_UP) && defined(NEXTION_OBJID_BUTTON_UP) bUp.attachPush(NextionbUpPushCallback, &bUp); @@ -8416,7 +8463,15 @@ void initialize_peripherals(){ tElValue.attachPush(NextiontElValuePushCallback, &tElValue); #endif #endif - + + // Azimuth and Elevation Label pushes (go to Secondary page) + + tAzLabel.attachPush(NextiontAzLabelPushCallback, &tAzLabel); + + #if defined(FEATURE_ELEVATION_CONTROL) && defined(NEXTION_OBJNAME_ELEVATION_LABEL) && defined(NEXTION_OBJID_ELEVATION_LABEL) + tElLabel.attachPush(NextiontElLabelPushCallback, &tElLabel); + #endif + #if defined(NEXTION_OBJNAME_DATAENT_CANCEL) && defined(NEXTION_OBJNAME_DATAENT_CANCEL) bDataEntryCancel.attachPush(NextionbDataEntryCancelPushCallback, &bDataEntryCancel); #endif @@ -8436,6 +8491,11 @@ void initialize_peripherals(){ bBackPageAbout.attachPush(NextionbBackPageAboutPushCallback, &bBackPageAbout); bNextPageAbout.attachPush(NextionbNextPageAboutPushCallback, &bNextPageAbout); + bBackPageSecondary.attachPush(NextionbBackPageSecondaryPushCallback, &bBackPageSecondary); + bNextPageSecondary.attachPush(NextionbNextPageSecondaryPushCallback, &bNextPageSecondary); + + bBackPageTertiary.attachPush(NextionbBackPageTertiaryPushCallback, &bBackPageTertiary); + bNextPageTertiary.attachPush(NextionbNextPageTertiaryPushCallback, &bNextPageTertiary); #endif diff --git a/k3ng_rotator_controller/rotator.h b/k3ng_rotator_controller/rotator.h index 26e2b9e..dbaacc1 100755 --- a/k3ng_rotator_controller/rotator.h +++ b/k3ng_rotator_controller/rotator.h @@ -188,6 +188,7 @@ #define DBG_CHECK_BUTTONS_RELEASE_NO_SLOWDOWN 64 #define DBG_CHECK_BUTTONS_RELEASE_KILL 65 +#define DBG_NEXTION_DATA_ENT_ENTER_PUSH_CALLBK 249 #define DBG_NEXTION_BUTTON 250 #define DBG_CHECK_BUTTONS_SUN 251 diff --git a/k3ng_rotator_controller/rotator_debug_log_activation.h b/k3ng_rotator_controller/rotator_debug_log_activation.h index 5b570ca..924c8bf 100644 --- a/k3ng_rotator_controller/rotator_debug_log_activation.h +++ b/k3ng_rotator_controller/rotator_debug_log_activation.h @@ -59,4 +59,5 @@ // #define DEBUG_A2_ENCODER // #define DEBUG_A2_ENCODER_LOOPBACK_TEST // #define DEBUG_QMC5883 -// #define DEBUG_ROTATION_STALL_DETECTION \ No newline at end of file +// #define DEBUG_ROTATION_STALL_DETECTION +// #define DEBUG_NEXTION_DISPLAY \ No newline at end of file diff --git a/k3ng_rotator_controller/rotator_features_test.h b/k3ng_rotator_controller/rotator_features_test.h index a41f37b..2567ba4 100755 --- a/k3ng_rotator_controller/rotator_features_test.h +++ b/k3ng_rotator_controller/rotator_features_test.h @@ -86,7 +86,10 @@ // #define FEATURE_FABO_LCD_PCF8574_DISPLAY // #define FEATURE_HD44780_I2C_DISPLAY // Not working yet -#define FEATURE_NEXTION_DISPLAY // Documentation: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display +// #define FEATURE_NEXTION_DISPLAY // Under Development Documentation: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display + +// #define FEATURE_NEXTION_DISPLAY_2 + // #define FEATURE_ANALOG_OUTPUT_PINS diff --git a/k3ng_rotator_controller/rotator_language.h b/k3ng_rotator_controller/rotator_language.h index 696bb41..d7c6a57 100644 --- a/k3ng_rotator_controller/rotator_language.h +++ b/k3ng_rotator_controller/rotator_language.h @@ -43,8 +43,11 @@ #define TOUCH_DISPLAY_DATA_ENTRY_SEPERATOR "." #define TOUCH_DISPLAY_DATA_ENTRY_DELETE "del" +//need to be copied below #define TOUCH_DISPLAY_PARKED_STRING "parked" #define TOUCH_DISPLAY_PARKING_STRING "Parking" +#define TOUCH_DISPLAY_ENTER_AZ "Enter Azimuth" +#define TOUCH_DISPLAY_ENTER_EL "Enter Elevation" #endif //LANGUAGE_ENGLISH #ifdef LANGUAGE_SPANISH // Courtesy of Maximo, EA1DDO diff --git a/k3ng_rotator_controller/rotator_nextion.h b/k3ng_rotator_controller/rotator_nextion.h index e85a258..505e289 100644 --- a/k3ng_rotator_controller/rotator_nextion.h +++ b/k3ng_rotator_controller/rotator_nextion.h @@ -8,14 +8,25 @@ Be sure to edit NexConfig.h in your Nextion library directory: - Comment out line 27 as follows: - //#define DEBUG_SERIAL_ENABLE - - Comment out line 32 as follows: - //#define dbSerial Serial + Comment out line 27 as follows: + //#define DEBUG_SERIAL_ENABLE + + Comment out line 32 as follows: + //#define dbSerial Serial - Edit line 37: - #define nexSerial Serial //<-- Change "Serial to whatever Arduino Serial port you're connecting the Nextion display to (probably Serial1 or Serial2) + Edit line 37: + #define nexSerial Serial //<-- Change "Serial to whatever Arduino Serial port you're connecting the Nextion display to (probably Serial1 or Serial2) + + + Also, change the following lines in NexHardware.cpp from: + + dbSerialBegin(9600); + nexSerial.begin(9600); + + To: + + dbSerialBegin(115200); + nexSerial.begin(115200); */ @@ -30,88 +41,167 @@ #define NEXTION_PAGE_DIAGNOSTICS_ID 2 #define NEXTION_PAGE_ABOUT_ID 3 #define NEXTION_PAGE_DATA_ENTRY 4 +#define NEXTION_PAGE_SPLASH 5 +#define NEXTION_PAGE_SECONDARY 6 +#define NEXTION_PAGE_TERTIARY 7 // Object Mappings - Update these to match the object names and IDs of the objects in your Nextion Editor HMI file. Comment out unused objects. -#define NEXTION_OBJNAME_MAIN_TITLE "tTitle" -#define NEXTION_OBJID_MAIN_TITLE 1 + + // Page Main (and global stuff) -#define NEXTION_OBJNAME_STATUS "tStat" -#define NEXTION_OBJID_STATUS 7 + #define NEXTION_OBJNAME_TIMER_RESET "tmInvokeReset" // this timer is enabled to trigger a reset and fix weirdness with the data entry screen + #define NEXTION_OBJID_TIMER_RESET 20 -#define NEXTION_OBJNAME_STATUS2 "tStat2" -#define NEXTION_OBJID_STATUS2 19 + #define NEXTION_OBJNAME_TIMER_AZ_ONLY "tmAzOnly" // this timer is enabled to make elevation objects disappear + #define NEXTION_OBJID_TIMER_AZ_ONLY 21 -#define NEXTION_OBJNAME_STATUS3 "tStat3" -#define NEXTION_OBJID_STATUS3 18 + #define NEXTION_OBJNAME_TIMER_AZ_EL "tmAzEl" // this timer is enabled to make elevation objects disappear + #define NEXTION_OBJID_TIMER_AZ_EL 24 -#define NEXTION_OBJNAME_AZIMUTH_LABEL "tlblAz" -#define NEXTION_OBJID_AZIMUTH_LABEL 2 + #define NEXTION_OBJNAME_MAIN_TITLE "tTitle" + #define NEXTION_OBJID_MAIN_TITLE 1 -#define NEXTION_OBJNAME_AZIMUTH_VALUE "tAz" -#define NEXTION_OBJID_AZIMUTH_VALUE 3 + #define NEXTION_OBJNAME_STATUS "tStat" + #define NEXTION_OBJID_STATUS 7 -#define NEXTION_OBJNAME_BUTTON_CW "bCW" -#define NEXTION_OBJID_BUTTON_CW 17 + #define NEXTION_OBJNAME_STATUS2 "tStat2" + #define NEXTION_OBJID_STATUS2 19 -#define NEXTION_OBJNAME_BUTTON_CCW "bCCW" -#define NEXTION_OBJID_BUTTON_CCW 4 + #define NEXTION_OBJNAME_STATUS3 "tStat3" + #define NEXTION_OBJID_STATUS3 18 -#define NEXTION_OBJNAME_BUTTON_UP "bUp" -#define NEXTION_OBJID_BUTTON_UP 15 + // Small Azimuth - az / el system + #define NEXTION_OBJNAME_AZIMUTH_LABEL_SMALL "tlblAzSm" + #define NEXTION_OBJID_AZIMUTH_LABEL_SMALL 2 -#define NEXTION_OBJNAME_BUTTON_DOWN "bDown" -#define NEXTION_OBJID_BUTTON_DOWN 16 + #define NEXTION_OBJNAME_AZIMUTH_VALUE_SMALL "tAzSm" + #define NEXTION_OBJID_AZIMUTH_VALUE_SMALL 3 -#define NEXTION_OBJNAME_BUTTON_STOP "bSTOP" -#define NEXTION_OBJID_BUTTON_STOP 5 + // Large Azimuth - az only system + #define NEXTION_OBJNAME_AZIMUTH_LABEL_LARGE "tlblAzLg" + #define NEXTION_OBJID_AZIMUTH_LABEL_LARGE 22 -#define NEXTION_OBJNAME_ELEVATION_LABEL "tlblEl" -#define NEXTION_OBJID_ELEVATION_LABEL 13 + #define NEXTION_OBJNAME_AZIMUTH_VALUE_LARGE "tAzLg" + #define NEXTION_OBJID_AZIMUTH_VALUE_LARGE 23 -#define NEXTION_OBJNAME_ELEVATION_VALUE "tEl" -#define NEXTION_OBJID_ELEVATION_VALUE 14 -#define NEXTION_OBJNAME_GPS "tGPS" -#define NEXTION_OBJID_GPS 7 + #define NEXTION_OBJNAME_BUTTON_CW "bCW" + #define NEXTION_OBJID_BUTTON_CW 17 -#define NEXTION_OBJNAME_CLOCK "tClk" -#define NEXTION_OBJID_CLOCK 8 + #define NEXTION_OBJNAME_BUTTON_CCW "bCCW" + #define NEXTION_OBJID_BUTTON_CCW 4 -#define NEXTION_OBJNAME_GRID "tGrid" -#define NEXTION_OBJID_GRID 9 + #define NEXTION_OBJNAME_BUTTON_UP "bUp" + #define NEXTION_OBJID_BUTTON_UP 15 -#define NEXTION_OBJNAME_COORDINATES "tCoord" -#define NEXTION_OBJID_COORDINATES 10 + #define NEXTION_OBJNAME_BUTTON_DOWN "bDown" + #define NEXTION_OBJID_BUTTON_DOWN 16 -#define NEXTION_OBJNAME_CODEVERSION "tCV" -#define NEXTION_OBJID_CODEVERSION 5 + #define NEXTION_OBJNAME_BUTTON_STOP "bSTOP" + #define NEXTION_OBJID_BUTTON_STOP 5 -#define NEXTION_OBJNAME_DIAGWINDOW "tDiag" -#define NEXTION_OBJID_DIAGWINDOW 4 + #define NEXTION_OBJNAME_ELEVATION_LABEL "tlblEl" + #define NEXTION_OBJID_ELEVATION_LABEL 13 -#define NEXTION_OBJNAME_DATAENT_CANCEL "bCan" -#define NEXTION_OBJID_DATAENT_CANCEL 14 + #define NEXTION_OBJNAME_ELEVATION_VALUE "tEl" + #define NEXTION_OBJID_ELEVATION_VALUE 14 -#define NEXTION_OBJNAME_DATAENT_ENTER "bEnt" -#define NEXTION_OBJID_DATAENT_ENTER 13 + #define NEXTION_OBJNAME_GPS "tGPS" + #define NEXTION_OBJID_GPS 7 -#define NEXTION_OBJNAME_DATAENT_DEL "bDel" -#define NEXTION_OBJID_DATAENT_DEL 12 + #define NEXTION_OBJNAME_CLOCK "tClk" + #define NEXTION_OBJID_CLOCK 8 -#define NEXTION_OBJNAME_DATAENT_SEPERATOR "bSep" -#define NEXTION_OBJID_DATAENT_SEPERATOR 11 + #define NEXTION_OBJNAME_GRID "tGrid" + #define NEXTION_OBJID_GRID 9 - + #define NEXTION_OBJNAME_COORDINATES "tCoord" + #define NEXTION_OBJID_COORDINATES 10 + + #define NEXTION_OBJNAME_CODEVERSION "tCV" + #define NEXTION_OBJID_CODEVERSION 5 + + // Page Diagnostics + + #define NEXTION_OBJNAME_DIAGWINDOW "tDiag" + #define NEXTION_OBJID_DIAGWINDOW 4 + + // Page Data Entry + + #define NEXTION_OBJNAME_DATAENT_TITLE "tTitle" + #define NEXTION_OBJID_DATAENT_TITLE 20 + + #define NEXTION_OBJNAME_DATAENT_ENTRY "tEntry" + #define NEXTION_OBJID_DATAENT_ENTRY 15 + + #define NEXTION_OBJNAME_DATAENT_MSG "tMsg" + #define NEXTION_OBJID_DATAENT_MSG 16 + + #define NEXTION_OBJNAME_DATAENT_CANCEL "bCan" + #define NEXTION_OBJID_DATAENT_CANCEL 14 + + #define NEXTION_OBJNAME_DATAENT_ENTER "bEnt" + #define NEXTION_OBJID_DATAENT_ENTER 13 + + #define NEXTION_OBJNAME_DATAENT_DEL "bDel" + #define NEXTION_OBJID_DATAENT_DEL 12 + + #define NEXTION_OBJNAME_DATAENT_SEPERATOR "bSep" + #define NEXTION_OBJID_DATAENT_SEPERATOR 11 + + #define NEXTION_OBJNAME_VAR_SEPERATOR "vaSepEntered" + #define NEXTION_OBJID_VAR_SEPERATOR 17 + + #define NEXTION_OBJNAME_VAR_ENTRYVAL "vaEntValue" + #define NEXTION_OBJID_VAR_ENTRYVAL 18 + + #define NEXTION_OBJNAME_VAR_ENTRYMODE "vaEntryMode" + #define NEXTION_OBJID_VAR_ENTRYMODE 19 + + #define NEXTION_OBJNAME_VAR_ENTLEN "vaEntLen" + #define NEXTION_OBJID_VAR_ENTLEN 21 + // Declare Nextion objects (page id, component id,component name) - do not touch these unless you know what you are doing // Main Page + +#if defined(NEXTION_OBJNAME_TIMER_RESET) && defined(NEXTION_OBJID_TIMER_RESET) + NexTimer timerInvokeReset= NexTimer(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_TIMER_RESET,NEXTION_OBJNAME_TIMER_RESET); +#endif + +#if defined(NEXTION_OBJNAME_TIMER_AZ_ONLY) && defined(NEXTION_OBJID_TIMER_AZ_ONLY) + NexTimer timerAzOnly= NexTimer(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_TIMER_AZ_ONLY,NEXTION_OBJNAME_TIMER_AZ_ONLY); +#endif + +#if defined(NEXTION_OBJNAME_TIMER_AZ_EL) && defined(NEXTION_OBJID_TIMER_AZ_EL) + NexTimer timerAzEl= NexTimer(NEXTION_OBJID_TIMER_AZ_EL, NEXTION_OBJID_TIMER_AZ_EL,NEXTION_OBJNAME_TIMER_AZ_EL); +#endif + #if defined(NEXTION_OBJNAME_MAIN_TITLE) && defined(NEXTION_OBJID_MAIN_TITLE) NexText tTitle = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_MAIN_TITLE, NEXTION_OBJNAME_MAIN_TITLE); #endif +#if defined(FEATURE_ELEVATION_CONTROL) // switch between large and small azimuth object for az-only and az/el systems + #if defined(NEXTION_OBJNAME_AZIMUTH_LABEL_SMALL) && defined(NEXTION_OBJID_AZIMUTH_LABEL_SMALL) + NexText tAzLabel = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_AZIMUTH_LABEL_SMALL, NEXTION_OBJNAME_AZIMUTH_LABEL_SMALL); + #endif + #if defined(NEXTION_OBJNAME_AZIMUTH_VALUE_SMALL) && defined(NEXTION_OBJID_AZIMUTH_VALUE_SMALL) + NexText tAzValue = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_AZIMUTH_VALUE_SMALL, NEXTION_OBJNAME_AZIMUTH_VALUE_SMALL); + #endif +#else + #if defined(NEXTION_OBJNAME_AZIMUTH_LABEL_LARGE) && defined(NEXTION_OBJID_AZIMUTH_LABEL_LARGE) + NexText tAzLabel = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_AZIMUTH_LABEL_LARGE, NEXTION_OBJNAME_AZIMUTH_LABEL_LARGE); + #endif + #if defined(NEXTION_OBJNAME_AZIMUTH_VALUE_LARGE) && defined(NEXTION_OBJID_AZIMUTH_VALUE_LARGE) + NexText tAzValue = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_AZIMUTH_VALUE_LARGE, NEXTION_OBJNAME_AZIMUTH_VALUE_LARGE); + #endif +#endif + + + #if defined(NEXTION_OBJNAME_STATUS) && defined(NEXTION_OBJID_STATUS) NexText tStatus = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_STATUS, NEXTION_OBJNAME_STATUS); #endif @@ -132,14 +222,6 @@ NexText tClock = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_CLOCK, NEXTION_OBJNAME_CLOCK); #endif -#if defined(NEXTION_OBJNAME_AZIMUTH_LABEL) && defined(NEXTION_OBJID_AZIMUTH_LABEL) - NexText tAzLabel = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_AZIMUTH_LABEL, NEXTION_OBJNAME_AZIMUTH_LABEL); -#endif - -#if defined(NEXTION_OBJNAME_AZIMUTH_VALUE) && defined(NEXTION_OBJID_AZIMUTH_VALUE) - NexText tAzValue = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_AZIMUTH_VALUE, NEXTION_OBJNAME_AZIMUTH_VALUE); -#endif - #if defined(NEXTION_OBJNAME_ELEVATION_LABEL) && defined(NEXTION_OBJID_ELEVATION_LABEL) NexText tElLabel = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_ELEVATION_LABEL, NEXTION_OBJNAME_ELEVATION_LABEL); #endif @@ -189,20 +271,49 @@ // Data Entry Page -#if defined(NEXTION_OBJNAME_DATAENT_CANCEL) && defined(NEXTION_OBJID_DATAENT_CANCEL) - NexButton bDataEntryCancel = NexButton(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_CANCEL, NEXTION_OBJNAME_DATAENT_CANCEL); +#if defined(NEXTION_OBJID_DATAENT_TITLE) && defined(NEXTION_OBJNAME_DATAENT_TITLE) + NexText tDataEntryTitle = NexText(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_TITLE, NEXTION_OBJNAME_DATAENT_TITLE); #endif + +#if defined(NEXTION_OBJID_DATAENT_ENTRY) && defined(NEXTION_OBJNAME_DATAENT_ENTRY) + NexText tDataEntryEntry = NexText(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_ENTRY, NEXTION_OBJNAME_DATAENT_ENTRY); +#endif + +#if defined(NEXTION_OBJNAME_DATAENT_CANCEL) && defined(NEXTION_OBJID_DATAENT_CANCEL) + NexButton bDataEntryCancel = NexButton(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_CANCEL, NEXTION_OBJNAME_DATAENT_CANCEL); +#endif + #if defined(NEXTION_OBJNAME_DATAENT_ENTER) && defined(NEXTION_OBJID_DATAENT_ENTER) NexButton bDataEntryEnter = NexButton(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_ENTER, NEXTION_OBJNAME_DATAENT_ENTER); #endif + #if defined(NEXTION_OBJNAME_DATAENT_DEL) && defined(NEXTION_OBJID_DATAENT_DEL) NexButton bDataEntryDelete = NexButton(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_DEL, NEXTION_OBJNAME_DATAENT_DEL); #endif + #if defined(NEXTION_OBJNAME_DATAENT_SEPERATOR) && defined(NEXTION_OBJID_DATAENT_SEPERATOR) NexButton bDataEntrySeperator = NexButton(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_SEPERATOR, NEXTION_OBJNAME_DATAENT_SEPERATOR); #endif +#if defined(NEXTION_OBJID_DATAENT_MSG) && defined(NEXTION_OBJNAME_DATAENT_MSG) + NexText tDataEntryMsg = NexText(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_DATAENT_MSG, NEXTION_OBJNAME_DATAENT_MSG); +#endif +#if defined(NEXTION_OBJID_VAR_SEPERATOR) && defined(NEXTION_OBJNAME_VAR_SEPERATOR) + NexVariable vDataEntrySeperatorEntered = NexVariable(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_VAR_SEPERATOR, NEXTION_OBJNAME_VAR_SEPERATOR); +#endif + +#if defined(NEXTION_OBJID_VAR_ENTRYVAL) && defined(NEXTION_OBJNAME_VAR_ENTRYVAL) + NexVariable vDataEntryValue = NexVariable(NEXTION_PAGE_DATA_ENTRY,NEXTION_OBJID_VAR_ENTRYVAL,NEXTION_OBJNAME_VAR_ENTRYVAL); +#endif + +#if defined(NEXTION_OBJID_VAR_ENTRYMODE) && defined(NEXTION_OBJNAME_VAR_ENTRYMODE) + NexVariable vDataEntryMode = NexVariable(NEXTION_PAGE_DATA_ENTRY,NEXTION_OBJID_VAR_ENTRYMODE,NEXTION_OBJNAME_VAR_ENTRYMODE); +#endif + +#if defined(NEXTION_OBJID_VAR_ENTLEN) && defined(NEXTION_OBJNAME_VAR_ENTLEN) + NexVariable vDataEntryDataEntryLength = NexVariable(NEXTION_PAGE_DATA_ENTRY, NEXTION_OBJID_VAR_ENTLEN, NEXTION_OBJNAME_VAR_ENTLEN); +#endif // Page Navigation Buttons - we have to detect page changes because the data in the objects is volatile. (Why, Nextion, why?) #define NEXTION_OBJNAME_BUTTON_BACK "bBack" @@ -217,13 +328,25 @@ #define NEXTION_OBJID_PAGE_DIAGNOSTICS_BUTTON_BACK 2 #define NEXTION_OBJID_PAGE_DIAGNOSTICS_BUTTON_NEXT 1 -#define NEXTION_OBJID_PAGE_ABOUT_BUTTON_BACK 3 +#define NEXTION_OBJID_PAGE_ABOUT_BUTTON_BACK 3 #define NEXTION_OBJID_PAGE_ABOUT_BUTTON_NEXT 4 +#define NEXTION_OBJID_PAGE_SECONDARY_BUTTON_BACK 1 +#define NEXTION_OBJID_PAGE_SECONDARY_BUTTON_NEXT 12 + +#define NEXTION_OBJID_PAGE_TERTIARY_BUTTON_BACK 1 +#define NEXTION_OBJID_PAGE_TERTIARY_BUTTON_NEXT 3 + NexButton bBackPageMain = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_PAGE_MAIN_BUTTON_BACK, NEXTION_OBJNAME_BUTTON_BACK); NexButton bNextPageMain = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_PAGE_MAIN_BUTTON_NEXT, NEXTION_OBJNAME_BUTTON_NEXT); +NexButton bBackPageSecondary = NexButton(NEXTION_PAGE_SECONDARY, NEXTION_OBJID_PAGE_SECONDARY_BUTTON_BACK, NEXTION_OBJNAME_BUTTON_BACK); +NexButton bNextPageSecondary = NexButton(NEXTION_PAGE_SECONDARY, NEXTION_OBJID_PAGE_SECONDARY_BUTTON_NEXT, NEXTION_OBJNAME_BUTTON_NEXT); + +NexButton bBackPageTertiary = NexButton(NEXTION_PAGE_TERTIARY, NEXTION_OBJID_PAGE_TERTIARY_BUTTON_BACK, NEXTION_OBJNAME_BUTTON_BACK); +NexButton bNextPageTertiary = NexButton(NEXTION_PAGE_TERTIARY, NEXTION_OBJID_PAGE_TERTIARY_BUTTON_NEXT, NEXTION_OBJNAME_BUTTON_NEXT); + NexButton bBackPageConfiguration = NexButton(NEXTION_PAGE_CONFIGURATION_ID, NEXTION_OBJID_PAGE_CONFIGURATION_BUTTON_BACK, NEXTION_OBJNAME_BUTTON_BACK); NexButton bNextPageConfiguration = NexButton(NEXTION_PAGE_CONFIGURATION_ID, NEXTION_OBJID_PAGE_CONFIGURATION_BUTTON_NEXT, NEXTION_OBJNAME_BUTTON_NEXT); @@ -239,7 +362,8 @@ NexPage pageConfiguration = NexPage(NEXTION_PAGE_CONFIGURATION_ID, 0, "Configura NexPage pageDiagnostics = NexPage(NEXTION_PAGE_DIAGNOSTICS_ID, 0, "Diagnostics"); NexPage pageAbout = NexPage(NEXTION_PAGE_ABOUT_ID, 0, "About"); NexPage pageDataEntry = NexPage(NEXTION_PAGE_DATA_ENTRY, 0, "DataEntry"); - +NexPage pageSecondary = NexPage(NEXTION_PAGE_SECONDARY, 0, "Secondary"); +NexPage pageTertiary = NexPage(NEXTION_PAGE_TERTIARY, 0, "Tertiary"); // Button registrations - do not touch these unless you know what you are doing NexTouch *nex_listen_list[] = { @@ -270,12 +394,14 @@ NexTouch *nex_listen_list[] = { #if defined(NEXTION_OBJNAME_DATAENT_SEPERATOR) && defined(NEXTION_OBJID_DATAENT_SEPERATOR) &bDataEntrySeperator, #endif - #if defined(NEXTION_OBJNAME_AZIMUTH_VALUE) && defined(NEXTION_OBJID_AZIMUTH_VALUE) - &tAzValue, - #endif + &tAzValue, #if defined(NEXTION_OBJNAME_ELEVATION_VALUE) && defined(NEXTION_OBJID_ELEVATION_VALUE) &tElValue, #endif + &tAzLabel, + #if defined(NEXTION_OBJNAME_ELEVATION_LABEL) && defined(NEXTION_OBJID_ELEVATION_LABEL) + &tElLabel, + #endif &bBackPageMain, &bNextPageMain, &bBackPageConfiguration, @@ -284,8 +410,17 @@ NexTouch *nex_listen_list[] = { &bNextPageDiagnostics, &bBackPageAbout, &bNextPageAbout, + &bBackPageSecondary, + &bNextPageSecondary, + &bBackPageTertiary, + &bNextPageTertiary, NULL }; +// Macros for stuff + +#define NEXTION_UNDEFINED 0 +#define NEXTION_DATA_ENTRY_MODE_AZ 1 +#define NEXTION_DATA_ENTRY_MODE_EL 2 diff --git a/k3ng_rotator_controller/rotator_nextion_api.h b/k3ng_rotator_controller/rotator_nextion_api.h new file mode 100644 index 0000000..cbab74f --- /dev/null +++ b/k3ng_rotator_controller/rotator_nextion_api.h @@ -0,0 +1,281 @@ +/* Nextion display settings and macros + + +API Based Solution - In Development + + + IMPORTANT ! + + + Be sure to edit NexConfig.h in your Nextion library directory: + + Comment out line 27 as follows: + //#define DEBUG_SERIAL_ENABLE + + Comment out line 32 as follows: + //#define dbSerial Serial + + Edit line 37: + #define nexSerial Serial //<-- Change "Serial to whatever Arduino Serial port you're connecting the Nextion display to (probably Serial1 or Serial2) + + + Also, change the following lines in NexHardware.cpp from: + + dbSerialBegin(9600); + nexSerial.begin(9600); + + To: + + dbSerialBegin(115200); + nexSerial.begin(115200); + +*/ + +#define NEXTION_API_PAGE_ID 0 + +//----------------------------------------------------------------------------------------------------------------------------- + + +// DESCRIPTION: The version of the API implementation in the display unit +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller <- Nextion +// PURPOSE: Used to determine if their is an API version mismatch between the rotator controller and the Nextion unit +#define NEXTION_API_NEXTION_API_VERSION_OBJECT_ID 1 +#define NEXTION_API_NEXTION_API_VERSION_OBJECT_NAME "v001NxAPIv" + +//----------------------------------------------------------------------------------------------------------------------------- + + +// DESCRIPTION: The version of the API implementation in the rotator controller +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Used to determine if their is an API version mismatch between the rotator controller and the Nextion unit +#define NEXTION_API_ROTATOR_CONTROLLER_API_VERSION_OBJECT_ID 2 +#define NEXTION_API_ROTATOR_CONTROLLER_API_VERSION_OBJECT_NAME "v002RCAPIv" + +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- + + + +// DESCRIPTION: The current state of the Nextion display +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller <- Nextion +// PURPOSE: Used to determine the current state of the Nextion display +#define NEXTION_API_NEXTION_STATE_OBJECT_ID 3 +#define NEXTION_API_NEXTION_STATE_OBJECT_NAME "v003NxSt" + // STATES + #define NEXTION_API_NEXTION_STATE_UNDEFINED 0 + #define NEXTION_API_NEXTION_STATE_INITIALIZING 1 + #define NEXTION_API_NEXTION_STATE_RUNNING 2 + + +//----------------------------------------------------------------------------------------------------------------------------- + + +// DESCRIPTION: The current state of the Rotator Controller +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Used to determine the current state of the Rotator Controller +#define NEXTION_API_RC_STATE_OBJECT_ID 4 +#define NEXTION_API_RC_STATE_OBJECT_NAME "v004RCSt" + // STATES + #define NEXTION_API_RC_STATE_UNDEFINED 0 + #define NEXTION_API_RC_STATE_INITIALIZING 1 + #define NEXTION_API_RC_STATE_RUNNING 2 + +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- + + +// DESCRIPTION: Nextion Unit Command +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Send a command to the Nextion +#define NEXTION_API_NEXTION_COMMAND_OBJECT_ID 5 +#define NEXTION_API_NEXTION_COMMAND_OBJECT_NAME "v005NxCmd" + + #define NEXTION_API_NEXTION_COMMAND_NO_CMD 0 + #define NEXTION_API_NEXTION_COMMAND_RESET 1 + + // DESCRIPTION: Nextion Unit Command Numeric Argument 1 + // DATATYPE: Numeric + // DATA FLOW: Rotator Controller -> Nextion + // PURPOSE: Send a numeric argument with a command to the Nextion + #define NEXTION_API_NEXTION_COMMANDN_NUM_ARG1_OBJECT_ID 6 + #define NEXTION_API_NEXTION_COMMAND_NUM_ARG1_OBJECT_NAME "v006NxCmdNum1" + + // DESCRIPTION: Nextion Unit Command Numeric Argument 2 + // DATATYPE: Numeric + // DATA FLOW: Rotator Controller -> Nextion + // PURPOSE: Send a numeric argument with a command to the Nextion + #define NEXTION_API_NEXTION_COMMAND_NUM_ARG2_OBJECT_ID 7 + #define NEXTION_API_NEXTION_COMMAND_NUM_ARG2_OBJECT_NAME "v007NxCmdNum2" + + // DESCRIPTION: Nextion Unit Command Numeric Argument 3 + // DATATYPE: Numeric + // DATA FLOW: Rotator Controller -> Nextion + // PURPOSE: Send a numeric argument with a command to the Nextion + #define NEXTION_API_NEXTION_COMMAND_NUM_ARG3_OBJECT_ID 8 + #define NEXTION_API_NEXTION_COMMAND_NUM_ARG3_OBJECT_NAME "v008NxCmdNum3" + + // DESCRIPTION: Nextion Unit Command String Argument 1 + // DATATYPE: String + // DATA FLOW: Rotator Controller -> Nextion + // PURPOSE: Send a text string argument with a command to the Nextion + #define NEXTION_API_NEXTION_COMMAND_STR_ARG1_OBJECT_ID 9 + #define NEXTION_API_NEXTION_COMMAND_STR_ARG1_OBJECT_NAME "v009NxCmdStr1" + + // DESCRIPTION: Nextion Unit Command String Argument 2 + // DATATYPE: String + // DATA FLOW: Rotator Controller -> Nextion + // PURPOSE: Send a text string argument with a command to the Nextion + #define NEXTION_API_NEXTION_COMMAND_STR_ARG2_OBJECT_ID 10 + #define NEXTION_API_NEXTION_COMMAND_STR_ARG2_OBJECT_NAME "v010NxCmdStr2" + + // DESCRIPTION: Nextion Unit Command String Argument 3 + // DATATYPE: String + // DATA FLOW: Rotator Controller -> Nextion + // PURPOSE: Send a text string argument with a command to the Nextion + #define NEXTION_API_NEXTION_COMMAND_STR_ARG3_OBJECT_ID 11 + #define NEXTION_API_NEXTION_COMMAND_STR_ARG3_OBJECT_NAME "v011NxCmdStr3" + +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- + + + +// DESCRIPTION: Rotator Controller Command +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller <- Nextion +// PURPOSE: Send a command to the Rotator Controller +#define NEXTION_API_RC_COMMAND_OBJECT_ID 12 +#define NEXTION_API_RC_COMMAND_OBJECT_NAME "v012RCCmd" + + + #define NEXTION_API_RC_COMMAND_NO_CMD 0 + #define NEXTION_API_RC_COMMAND_STOP_ALL 1 + #define NEXTION_API_RC_COMMAND_STOP_AZ 2 + #define NEXTION_API_RC_COMMAND_STOP_EL 3 + #define NEXTION_API_RC_COMMAND_ROTATE_CCW 4 + #define NEXTION_API_RC_COMMAND_ROTATE_CW 5 + #define NEXTION_API_RC_COMMAND_UP 6 + #define NEXTION_API_RC_COMMAND_DOWN 7 + #define NEXTION_API_RC_COMMAND_ROTATE_AZ_TO 8 + #define NEXTION_API_RC_COMMAND_ROTATE_EL_TO 9 + #define NEXTION_API_RC_COMMAND_SET_CLOCK 10 + + + // DESCRIPTION: Rotator Controller Command Numeric Argument 1 + // DATATYPE: Numeric + // DATA FLOW: Rotator Controller <- Nextion + // PURPOSE: Send a numeric argument with a command to the Rotator Controller + #define NEXTION_API_RC_COMMAND_NUM_ARG1_OBJECT_ID 13 + #define NEXTION_API_RC_COMMAND_NUM_ARG1_OBJECT_NAME "v013RCCmdNum1" + + // DESCRIPTION: Rotator Controller Command Numeric Argument 2 + // DATATYPE: Numeric + // DATA FLOW: Rotator Controller <- Nextion + // PURPOSE: Send a numeric argument with a command to the Rotator Controller + #define NEXTION_API_RC_COMMAND_NUM_ARG2_OBJECT_ID 14 + #define NEXTION_API_RC_COMMAND_NUM_ARG2_OBJECT_NAME "v014RCCmdNum2" + + // DESCRIPTION: Rotator Controller Command Numeric Argument 3 + // DATATYPE: Numeric + // DATA FLOW: Rotator Controller <- Nextion + // PURPOSE: Send a numeric argument with a command to the Rotator Controller + #define NEXTION_API_RC_COMMAND_NUM_ARG3_OBJECT_ID 15 + #define NEXTION_API_RC_COMMAND_NUM_ARG3_OBJECT_NAME "v015RCCmdNum3" + + // DESCRIPTION: Rotator Controller Command String Argument 1 + // DATATYPE: String + // DATA FLOW: Rotator Controller <- Nextion + // PURPOSE: Send a text string argument with a command to the Rotator Controller + #define NEXTION_API_RC_COMMAND_STR_ARG1_OBJECT_ID 16 + #define NEXTION_API_RC_COMMAND_STR_ARG1_OBJECT_NAME "v016RCCmdStr1" + + // DESCRIPTION: Rotator Controller Command String Argument 2 + // DATATYPE: String + // DATA FLOW: Rotator Controller <- Nextion + // PURPOSE: Send a text string argument with a command to the Rotator Controller + #define NEXTION_API_RC_COMMAND_STR_ARG2_OBJECT_ID 17 + #define NEXTION_API_RC_COMMAND_STR_ARG2_OBJECT_NAME "v017RCCmdStr2" + + // DESCRIPTION: Rotator Controller Command String Argument 3 + // DATATYPE: String + // DATA FLOW: Rotator Controller <- Nextion + // PURPOSE: Send a text string argument with a command to the Rotator Controller + #define NEXTION_API_RC_COMMAND_STR_ARG3_OBJECT_ID 18 + #define NEXTION_API_RC_COMMAND_STR_ARG3_OBJECT_NAME "v018RCCmdStr3" + +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- + + +// DESCRIPTION: System Capabilities +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Set the supported capabilities +#define NEXTION_API_SYSTEM_CAPABILITIES_OBJECT_ID 19 +#define NEXTION_API_SYSTEM_CAPABILITIES_OBJECT_NAME "v019SysCap" + + // bits + #define NEXTION_API_SYSTEM_CAPABILITIES_GS_232A 1 + #define NEXTION_API_SYSTEM_CAPABILITIES_GS_232B 2 + #define NEXTION_API_SYSTEM_CAPABILITIES_EASYCOM 4 + #define NEXTION_API_SYSTEM_CAPABILITIES_DCU_1 8 + #define NEXTION_API_SYSTEM_CAPABILITIES_ELEVATION 16 + #define NEXTION_API_SYSTEM_CAPABILITIES_CLOCK 32 + #define NEXTION_API_SYSTEM_CAPABILITIES_GPS 64 + #define NEXTION_API_SYSTEM_CAPABILITIES_MOON 128 + #define NEXTION_API_SYSTEM_CAPABILITIES_SUN 256 + #define NEXTION_API_SYSTEM_CAPABILITIES_RTC 512 + +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------------------------------- + +// Dynamically / Frequently Updated Variables + +// DESCRIPTION: Real Azimuth +// DATATYPE: Number +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Stores the current real azimuth (0 - 360 degrees). Since the Nextion only handles integers, +// this is the real azimuth * 1000 +#define NEXTION_API_AZ_OBJECT_ID 20 +#define NEXTION_API_AZ_OBJECT_NAME "v020Az" + + +// DESCRIPTION: Raw Azimuth +// DATATYPE: Number +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Stores the current raw azimuth (in overlap this is equal to real azimuth + 360). Since the Nextion only handles integers, +// this is the raw azimuth * 1000 +#define NEXTION_API_RAW_AZ_OBJECT_ID 21 +#define NEXTION_API_RAW_AZ_OBJECT_NAME "v021AzRaw" + +// DESCRIPTION: Elevation +// DATATYPE: Number +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: Stores the current elevation. Since the Nextion only handles integers, +// this is the elevation * 1000 +#define NEXTION_API_EL_OBJECT_ID 22 +#define NEXTION_API_EL_OBJECT_NAME "v022El" + + + + + + + +// DESCRIPTION: +// DATATYPE: Numeric +// DATA FLOW: Rotator Controller -> Nextion +// PURPOSE: + + +NexVariable vNextionAPIVersion = NexVariable(NEXTION_API_PAGE_ID, NEXTION_API_NEXTION_API_VERSION_OBJECT_ID, NEXTION_API_NEXTION_API_VERSION_OBJECT_NAME); \ No newline at end of file diff --git a/k3ng_rotator_controller/rotator_pins_test.h b/k3ng_rotator_controller/rotator_pins_test.h index abddba4..65f3d9b 100644 --- a/k3ng_rotator_controller/rotator_pins_test.h +++ b/k3ng_rotator_controller/rotator_pins_test.h @@ -17,11 +17,11 @@ #define pins_h -#define rotate_cw 33 //A3 //6 // goes high to activate rotator R (CW) rotation - pin 1 on Yaesu connector -#define rotate_ccw 31 //A2 //7 // goes high to activate rotator L (CCW) rotation - pin 2 on Yaesu connector +#define rotate_cw 7 //33 //A3 //6 // goes high to activate rotator R (CW) rotation - pin 1 on Yaesu connector +#define rotate_ccw 6 //31 //A2 //7 // goes high to activate rotator L (CCW) rotation - pin 2 on Yaesu connector #define rotate_cw_ccw 0 // goes high for both CW and CCW rotation -#define rotate_cw_pwm 0 // optional - PWM CW output - set to 0 to disable (must be PWM capable pin) -#define rotate_ccw_pwm 0 // optional - PWM CCW output - set to 0 to disable (must be PWM capable pin) +#define rotate_cw_pwm 0 //7 // optional - PWM CW output - set to 0 to disable (must be PWM capable pin) +#define rotate_ccw_pwm 0 //6 // optional - PWM CCW output - set to 0 to disable (must be PWM capable pin) #define rotate_cw_ccw_pwm 0 #define rotate_cw_freq 0 #define rotate_ccw_freq 0 @@ -46,11 +46,11 @@ // elevation pins #ifdef FEATURE_ELEVATION_CONTROL #define elevation_speed_voltage 0 // optional - PWM output for speed control voltage feed into rotator (on continually unlike rotate_up_pwm and rotate_down_pwm) -#define rotate_up 37 //A5 //9//9 // goes high to activate rotator elevation up -#define rotate_down 35 //A4 //8 // goes high to activate rotator elevation down +#define rotate_up 9 //37 //A5 //9//9 // goes high to activate rotator elevation up +#define rotate_down 8 //35 //A4 //8 // goes high to activate rotator elevation down #define rotate_up_or_down 0 -#define rotate_up_pwm 0 -#define rotate_down_pwm 0 +#define rotate_up_pwm 0 //9 +#define rotate_down_pwm 0 //8 #define rotate_up_down_pwm 0 #define rotate_up_freq 0 #define rotate_down_freq 0