2020.04.18.01

More work on FEATURE_NEXTION_DISPLAY, Nextion Display API (UNDER DEVELOPMENT)
      Documentation in progress: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display
This commit is contained in:
Anthony Good 2020-04-18 15:16:45 -04:00
parent 446629c2e7
commit 81f43ee657
12 changed files with 505 additions and 1469 deletions

View File

@ -430,7 +430,7 @@
Implemented a round robin screen redraw in rotator_k3ngdisplay.cpp
2020.03.30.01
FEATURE_NEXTION_DISPLAY - Nextion display support UNDER DEVELOPMENT
FEATURE_NEXTION_DISPLAY_OLD - Nextion display support UNDER DEVELOPMENT
Added file rotator_nextion.h
Documentation in progress: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display
@ -447,6 +447,10 @@
2020.04.03.01
Fixed issue with 20 column LCD displays and spacing of az and el readings (Thanks Steve VE3RX)
2020.04.18.01
More work on FEATURE_NEXTION_DISPLAY, Nextion Display API (UNDER DEVELOPMENT)
Documentation in progress: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display
All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc.
Anything rotator_*.* should be in the ino directory!
@ -456,7 +460,7 @@
*/
#define CODE_VERSION "2020.04.06.01"
#define CODE_VERSION "2020.04.18.01"
#include <avr/pgmspace.h>
#include <EEPROM.h>
@ -622,14 +626,6 @@
#endif
#endif
#ifdef FEATURE_NEXTION_DISPLAY
#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"
@ -1136,15 +1132,6 @@ DebugClass debug;
unsigned long last_activity_time_autopark = 0;
#endif
#ifdef FEATURE_NEXTION_DISPLAY
#include "rotator_nextion.h"
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 --------------------*/
@ -1215,7 +1202,7 @@ void loop() {
update_lcd_display();
#endif
#ifdef FEATURE_NEXTION_DISPLAY
#if defined(FEATURE_NEXTION_DISPLAY)
service_nextion_display();
#endif
@ -3717,303 +3704,10 @@ char * azimuth_direction(int azimuth_in){
#endif /* ifdef FEATURE_LCD_DISPLAY */
// --------------------------------------------------------------
// #if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_CW) && defined(NEXTION_OBJID_BUTTON_CW)
// void NextionbCWPopCallback(void *ptr) { // button release
// submit_request(AZ, REQUEST_STOP, 0, DBG_NEXTION_BUTTON);
// }
// #endif
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_CW) && defined(NEXTION_OBJID_BUTTON_CW)
void NextionbCWPushCallback(void *ptr) { // button press
submit_request(AZ, REQUEST_CW, 0, DBG_NEXTION_BUTTON);
}
#endif
// --------------------------------------------------------------
//#if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW)
// void NextionbCCWPopCallback(void *ptr) { // button release
// submit_request(AZ, REQUEST_STOP, 0, DBG_NEXTION_BUTTON);
// }
// #endif
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW)
void NextionbCCWPushCallback(void *ptr) { // button press
submit_request(AZ, REQUEST_CCW, 0, DBG_NEXTION_BUTTON);
}
#endif
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_STOP) && defined(NEXTION_OBJID_BUTTON_STOP)
void NextionbSTOPPushAndPopCallback(void *ptr) { // button press and release, just to be safe
submit_request(AZ, REQUEST_STOP, 0, DBG_NEXTION_BUTTON);
#if defined(FEATURE_ELEVATION_CONTROL)
submit_request(EL, REQUEST_STOP, 0, DBG_NEXTION_BUTTON);
#endif
}
#endif
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW) && defined(FEATURE_ELEVATION_CONTROL)
void NextionbUpPushCallback(void *ptr) { // button press
submit_request(EL, REQUEST_UP, 0, DBG_NEXTION_BUTTON);
}
#endif
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY) && defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW) && defined(FEATURE_ELEVATION_CONTROL)
void NextionbDownPushCallback(void *ptr) { // button press
submit_request(EL, REQUEST_DOWN, 0, DBG_NEXTION_BUTTON);
}
#endif
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY)
void NextionbBackPageMainPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_ABOUT_ID, NEXTION_UNDEFINED);
}
void NextionbNextPageMainPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_CONFIGURATION_ID, NEXTION_UNDEFINED);
}
void NextionbBackPageConfigurationPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED);
}
void NextionbNextPageConfigurationPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_UNDEFINED);
}
void NextionbBackPageDiagnosticsPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_CONFIGURATION_ID, NEXTION_UNDEFINED);
}
void NextionbNextPageDiagnosticsPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_ABOUT_ID, NEXTION_UNDEFINED);
}
void NextionbBackPageAboutPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_UNDEFINED);
}
void NextionbNextPageAboutPushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED);
}
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){
NextionPageRefresh(NEXTION_PAGE_MAIN_ID, NEXTION_UNDEFINED);
}
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;
#if defined(DEBUG_NEXTION_DISPLAY)
debug.print("NextionbDataEntryEnterPushCallback: data_entry_mode: ");
#endif
//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);
}
void NextiontAzValuePushCallback(void *ptr){
NextionPageRefresh(NEXTION_PAGE_DATA_ENTRY,NEXTION_DATA_ENTRY_MODE_AZ);
}
void NextiontElValuePushCallback(void *ptr){
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,byte other_information){
// load up pages and populate as appropriate
switch (page_id){
case NEXTION_PAGE_MAIN_ID:
pageMain.show();
#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
tTitle.setText(TOUCH_DISPLAY_TITLE);
tAzLabel.setText(AZIMUTH_STRING_NO_SPACE);
bCW.setText(CW_STRING);
bCCW.setText(CCW_STRING);
bSTOP.setText(TOUCH_DISPLAY_STOP_STRING);
nextion_current_screen = NEXTION_PAGE_MAIN_ID;
break;
case NEXTION_PAGE_CONFIGURATION_ID:
pageConfiguration.show();
nextion_current_screen = NEXTION_PAGE_CONFIGURATION_ID;
break;
case NEXTION_PAGE_DIAGNOSTICS_ID:
pageDiagnostics.show();
nextion_current_screen = NEXTION_PAGE_DIAGNOSTICS_ID;
tDiag.setText("Test 1 2 3\r\n4 5 6\n7 8 9\r\n");
break;
case NEXTION_PAGE_ABOUT_ID:
pageAbout.show();
nextion_current_screen = NEXTION_PAGE_ABOUT_ID;
tCV.setText(CODE_VERSION);
break;
case NEXTION_PAGE_DATA_ENTRY:
pageDataEntry.show();
nextion_current_screen = NEXTION_PAGE_DATA_ENTRY;
bDataEntryCancel.setText(TOUCH_DISPLAY_DATA_ENTRY_CANCEL);
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;
}
}
#endif
// --------------------------------------------------------------
//zzzzzz
#if defined(FEATURE_NEXTION_DISPLAY)
#if defined(FEATURE_NEXTION_DISPLAY_OLD)
void service_nextion_display(){
/*
TODO:
Azimuth & Elevation Data Entry in Display
Azimuth Direction
Pages
Secondary
Presets
Park Button
Long path
Moon
Sun
Data Entry
Configuration
Event Log?
Diagnostics
Serial Sniff?
Debug Log?
*/
char workstring1[32] = "";
@ -4462,12 +4156,400 @@ void service_nextion_display(){
}
#endif // defined(FEATURE_NEXTION_DISPLAY)
#endif // defined(FEATURE_NEXTION_DISPLAY_OLD)
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY)
void sendNextionCommand(const char* send_command){
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_SEND)
debug.print("\r\nsendNextionCommand: send:");
debug.println(send_command);
#endif
nexSerial.print(send_command);
nexSerial.write(0xFF);
nexSerial.write(0xFF);
nexSerial.write(0xFF);
}
#endif //FEATURE_NEXTION_DISPLAY
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY)
uint16_t recvNextionRetString(char *buffer, uint16_t len, uint32_t timeout){
uint16_t ret = 0;
bool received_start_byte = false;
uint8_t counter_0xff_bytes = 0;
String temp = String("");
uint8_t serial_byte = 0;
unsigned long start;
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.print("\r\nrecvNextionRetString: rcv:");
#endif
start = millis();
while ((millis() - start) <= timeout){
while (nexSerial.available()){
serial_byte = nexSerial.read();
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.write(serial_byte);
#endif
if (received_start_byte){
if (serial_byte == 0xFF){
counter_0xff_bytes++;
if (counter_0xff_bytes >= 3){
break;
}
} else {
temp += (char)serial_byte;
}
} else if (serial_byte == 0x70){ //0x70 is starting byte that is discarded
received_start_byte = true;
}
}
if (counter_0xff_bytes >= 3){
break;
}
}
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.println("$");
if (millis() - start > timeout){
debug.println("\r\nrecvNextionRetString: timeout");
}
#endif
ret = temp.length();
if (ret > len){
ret = len;
}
strncpy(buffer, temp.c_str(), ret);
return ret;
}
#endif //FEATURE_NEXTION_DISPLAY
// --------------------------------------------------------------
#if defined(FEATURE_NEXTION_DISPLAY)
void service_nextion_display(){
char workstring1[32] = "";
char workstring2[32] = "";
static int last_azimuth = 0;
static unsigned long last_az_update = 0;
static unsigned long last_various_things_update = 0;
int temp = 0;
char *buffer;
uint16_t len;
#if defined(FEATURE_ELEVATION_CONTROL)
static int last_elevation = 0;
static unsigned long last_el_update = 0;
#endif
#if defined(FEATURE_CLOCK)
static int last_clock_seconds = 0;
#endif
#if defined(FEATURE_GPS) && defined(FEATURE_CLOCK)
static byte last_clock_status = clock_status;
static byte last_gps_sats = 0;
#endif
static byte last_az_state = IDLE;
#if defined(FEATURE_ELEVATION_CONTROL)
static byte last_el_state = IDLE;
#endif
#if defined(FEATURE_GPS)
static unsigned long last_grid_update = 0;
#endif
#if defined(FEATURE_GPS)
static unsigned long last_coord_update = 0;
static unsigned long last_gps_update = 0;
unsigned long gps_fix_age_temp = 0;
float gps_lat_temp = 0;
float gps_long_temp = 0;
#endif
#if defined(ANALOG_AZ_OVERLAP_DEGREES)
static byte last_overlap_indicator = 0;
byte overlap_indicator = 0;;
#endif
#if defined(FEATURE_PARK)
static byte last_park_status = NOT_PARKED;
#endif
#if defined(ANALOG_AZ_OVERLAP_DEGREES)
static unsigned long last_status3_update = 0;
#endif
//zzzzzz
#define NEXTION_FREQUENT_UPDATE_MS 500
#define NEXTION_LESS_FREQUENT_UPDATE_MS 1000
uint8_t serial_byte = 0;
unsigned long last_serial_receive_time = 0;
static int nextion_port_buffer_index = 0;
static byte nextion_port_buffer[32];
char return_string[32];
static byte received_backslash = 0;
// Get incoming commands
if (nexSerial.available()){
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.print("\r\nservice_nextion_display: recv:");
#endif
while (nexSerial.available()){
serial_byte = nexSerial.read();
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.write(serial_byte);
#endif
last_serial_receive_time = millis();
if ((serial_byte > 96) && (serial_byte < 123)) { // uppercase it
serial_byte = serial_byte - 32;
}
if (serial_byte == '\\'){
received_backslash = 1;
}
if ((serial_byte != 10) && (serial_byte != 13) && received_backslash) { // add it to the buffer if it's not a line feed or carriage return
nextion_port_buffer[nextion_port_buffer_index] = serial_byte;
nextion_port_buffer_index++;
}
if ((serial_byte == 13) || (nextion_port_buffer_index > 31)){ // do we have a carriage return or have we hit the end of the buffer?
process_backslash_command(nextion_port_buffer, nextion_port_buffer_index, 0, return_string);
nextion_port_buffer_index = 0;
received_backslash = 0;
last_serial_receive_time = 0;
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.print("\r\nservice_nextion_display: recv: return_string:");
debug.println(return_string);
#endif
}
} //while (nexSerial.available())
#if defined(DEBUG_NEXTION_DISPLAY_SERIAL_RECV)
debug.println("$");
#endif
} //if (nexSerial.available())
// timeout the receive buffer if it's been sitting there awhile with no carriage return
if ((millis() - last_serial_receive_time) > 3000){
nextion_port_buffer_index = 0;
received_backslash = 0;
last_serial_receive_time = 0;
}
// Update various things
if ((millis() - last_various_things_update) > NEXTION_LESS_FREQUENT_UPDATE_MS){
// Rotator Controller API Implementation Version
sendNextionCommand("vRCAPIv.txt=\"2020041701\"");
// Rotator Controller Arduino Code Version
strcpy(workstring1,"vRCVersion.txt=\"");
strcat(workstring1,CODE_VERSION);
strcat(workstring1,"\"");
sendNextionCommand(workstring1);
// System Capabilities
#if defined(FEATURE_YAESU_EMULATION)
#if defined(OPTION_GS_232B_EMULATION)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_GS_232B; //2
#else
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_GS_232A; //1
#endif
#endif
#if defined(FEATURE_EASYCOM_EMULATION)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_EASYCOM; //4
#endif
#if defined(FEATURE_DCU_1_EMULATION)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_DCU_1; //8
#endif
#if defined(FEATURE_ELEVATION_CONTROL)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_ELEVATION; //16
#endif
#if defined(FEATURE_CLOCK)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_CLOCK; //32
#endif
#if defined(FEATURE_GPS)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_GPS; //64
#endif
#if defined(FEATURE_MOON_TRACKING)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_MOON; //128
#endif
#if defined(FEATURE_SUN_TRACKING)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_SUN; //256
#endif
#if defined(FEATURE_RTC_DS1307) || defined(FEATURE_RTC_PCF8583)
temp = temp | NEXTION_API_SYSTEM_CAPABILITIES_RTC; //512
#endif
strcpy(workstring1,"gSC=");
dtostrf(temp, 1, 0, workstring2);
strcat(workstring1,workstring2);
sendNextionCommand(workstring1);
last_various_things_update = millis();
}
// Azimuth
if (((azimuth != last_azimuth) || ((millis() - last_az_update) > NEXTION_FREQUENT_UPDATE_MS))){
dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1);
//strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/); // haven't figured out how the hell to get degrees symbol to display
strcpy(workstring2,"vAz.txt=\"");
strcat(workstring2,workstring1);
strcat(workstring2,"\"");
#if defined(DEBUG_NEXTION_DISPLAY)
debug.print("service_nextion_display: cmd: ");
debug.println(workstring2);
#endif
sendNextionCommand(workstring2);
last_azimuth = azimuth;
last_az_update = millis();
#if defined(DEBUG_NEXTION_DISPLAY)
sendNextionCommand("prints vAz.txt,6");
// sendNextionCommand("get vAz.txt");
len = 6;
recvNextionRetString(buffer,len,500);
debug.print("\r\nservice_nextion_display: get recv len: ");
debug.print(len);
debug.print(" buffer: ");
debug.println(buffer);
#endif
}
// Elevation
#if defined(FEATURE_ELEVATION_CONTROL)
if ((elevation != last_elevation) || ((millis() - last_el_update) > NEXTION_FREQUENT_UPDATE_MS)){
dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1);
//strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/);
strcpy(workstring2,"vEl.txt=\"");
strcat(workstring2,workstring1);
strcat(workstring2,"\"");
sendNextionCommand(workstring2);
last_elevation = elevation;
last_el_update = millis();
}
#endif
// Clock
#if defined(FEATURE_CLOCK)
update_time();
if (local_clock_seconds != last_clock_seconds){
last_clock_seconds = clock_seconds;
strcpy(workstring1,"vClk.txt=\"");
#ifdef OPTION_CLOCK_ALWAYS_HAVE_HOUR_LEADING_ZERO
if (local_clock_hours < 10) {
strcpy(workstring1, "0");
dtostrf(local_clock_hours, 0, 0, workstring2);
strcat(workstring1,workstring2);
} else {
dtostrf(local_clock_hours, 0, 0, workstring2);
strcpy(workstring1,workstring2);
}
#else
dtostrf(local_clock_hours, 0, 0, workstring2);
strcat(workstring1,workstring2);
#endif //OPTION_CLOCK_ALWAYS_HAVE_HOUR_LEADING_ZERO
strcat(workstring1,":");
if (local_clock_minutes < 10) {
strcat(workstring1, "0");
}
dtostrf(local_clock_minutes, 0, 0, workstring2);
strcat(workstring1,workstring2);
strcat(workstring1,":");
if (local_clock_seconds < 10) {
strcat(workstring1, "0");
}
dtostrf(local_clock_seconds, 0, 0, workstring2);
strcat(workstring1,workstring2);
strcat(workstring1,"\"");
sendNextionCommand(workstring1);
}
#endif //FEATURE_CLOCK
// GPS
#if defined(FEATURE_GPS) && defined(FEATURE_CLOCK)
if ((last_clock_status != clock_status) || (last_gps_sats != gps.satellites()) || ((millis()-last_gps_update) > NEXTION_FREQUENT_UPDATE_MS)){
if ((clock_status == GPS_SYNC) || (clock_status == SLAVE_SYNC_GPS)) {
strcpy(workstring1,"vGPS.txt=\"");
strcat(workstring1,GPS_STRING);
strcat(workstring1," ");
dtostrf(gps.satellites(),0,0,workstring2);
strcat(workstring1,workstring2);
strcat(workstring1," Sats");
strcat(workstring1,"\"");
sendNextionCommand(workstring1);
last_gps_sats = gps.satellites();
} else {
sendNextionCommand("vGPS.txt=\"\"");
}
last_gps_sats = gps.satellites();
last_clock_status = clock_status;
last_gps_update = millis();
}
#endif //defined(FEATURE_GPS)
//GRID
#if defined(FEATURE_GPS)
if ((millis() - last_grid_update) > (NEXTION_LESS_FREQUENT_UPDATE_MS-125)){
strcpy(workstring1,"vGrid.txt=\"");
strcat(workstring1,coordinates_to_maidenhead(latitude,longitude));
strcat(workstring1,"\"");
sendNextionCommand(workstring1);
last_grid_update = millis();
}
#endif
//COORDINATES
#if defined(FEATURE_GPS)
if ((millis() - last_coord_update) > (NEXTION_LESS_FREQUENT_UPDATE_MS+125)){
if ((clock_status == GPS_SYNC) || (clock_status == SLAVE_SYNC_GPS)) {
gps.f_get_position(&gps_lat_temp,&gps_long_temp,&gps_fix_age_temp);
strcpy(workstring1,"vCrd.txt=\"");
dtostrf(gps_lat_temp,4,4,workstring2);
strcat(workstring1,workstring2);
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");
strcat(workstring1,"\"");
sendNextionCommand(workstring1);
} else {
sendNextionCommand("vCrd.txt=\"\"");
}
last_coord_update = millis();
}
#endif
}
#endif //FEATURE_NEXTION_DISPLAY
// --------------------------------------------------------------
#if defined(FEATURE_LCD_DISPLAY)
void update_lcd_display(){
@ -5320,6 +5402,8 @@ void update_lcd_display(){
#endif // defined(FEATURE_LCD_DISPLAY)
// --------------------------------------------------------------
#if defined(FEATURE_REMOTE_UNIT_SLAVE) || defined(FEATURE_YAESU_EMULATION) || defined(FEATURE_EASYCOM_EMULATION)
void get_keystroke(){
@ -8431,75 +8515,16 @@ void initialize_peripherals(){
//zzzzzzzzz
#ifdef FEATURE_NEXTION_DISPLAY
nexInit();
timerInvokeReset.enable(); // manually invoke a hardware reset - this is to fix issues with data entry page
nexSerial.begin(NEXTION_SERIAL_BAUD);
delay(250);
sendNextionCommand("rest");
#endif //FEATURE_NEXTION_DISPLAY
// Register events
#if defined(NEXTION_OBJNAME_BUTTON_CW) && defined(NEXTION_OBJID_BUTTON_CW)
bCW.attachPush(NextionbCWPushCallback, &bCW);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW)
bCCW.attachPush(NextionbCCWPushCallback, &bCCW);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_STOP) && defined(NEXTION_OBJID_BUTTON_STOP)
bSTOP.attachPush(NextionbSTOPPushAndPopCallback, &bSTOP);
bSTOP.attachPop(NextionbSTOPPushAndPopCallback, &bSTOP);
#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);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_DOWN) && defined(NEXTION_OBJID_BUTTON_DOWN)
bDown.attachPush(NextionbDownPushCallback, &bDown);
#endif
// Elevation Value Press (go to data entry page)
#if defined(NEXTION_OBJNAME_ELEVATION_VALUE) && defined(NEXTION_OBJID_ELEVATION_VALUE)
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
#if defined(NEXTION_OBJNAME_DATAENT_ENTER) && defined(NEXTION_OBJID_DATAENT_ENTER)
bDataEntryEnter.attachPush(NextionbDataEntryEnterPushCallback, &bDataEntryEnter);
#endif
bBackPageMain.attachPush(NextionbBackPageMainPushCallback, &bBackPageMain);
bNextPageMain.attachPush(NextionbNextPageMainPushCallback, &bNextPageMain);
bBackPageConfiguration.attachPush(NextionbBackPageConfigurationPushCallback, &bBackPageConfiguration);
bNextPageConfiguration.attachPush(NextionbNextPageConfigurationPushCallback, &bNextPageConfiguration);
bBackPageDiagnostics.attachPush(NextionbBackPageDiagnosticsPushCallback, &bBackPageDiagnostics);
bNextPageDiagnostics.attachPush(NextionbNextPageDiagnosticsPushCallback, &bNextPageDiagnostics);
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
#ifdef FEATURE_AZ_POSITION_HMC5883L
compass = HMC5883L();
@ -13124,7 +13149,8 @@ Not implemented yet:
*/
if ((input_buffer[2] == 'D') && (input_buffer[3] == 'I')) { // \?DIxx - digital pin initialize as input; xx = pin #
if ((input_buffer[2] == 'D') && (input_buffer[3] == 'I')) { // \?DIxx - digital pin initialize as input; xx = pin #
if ((((input_buffer[4] > 47) && (input_buffer[4] < 58)) || (toupper(input_buffer[4]) == 'A')) && (input_buffer[5] > 47) && (input_buffer[5] < 58)) {
byte pin_value = 0;
if (toupper(input_buffer[4]) == 'A') {
@ -13217,33 +13243,85 @@ Not implemented yet:
}
} //if ((input_buffer_index == 6)
int hit_decimal = 0;
if ((input_buffer[2] == 'G') && (input_buffer[3] == 'A')) { // \?GAxxx.x - go to AZ xxx.x
heading = 0;
for (int x = 4;x < input_buffer_index;x++){
if(input_buffer[x] == '.'){
hit_decimal = 10;
} else {
if (hit_decimal > 0){
heading = heading + ((float)(input_buffer[x] - 48) / (float)hit_decimal);
hit_decimal = hit_decimal * 10;
} else {
heading = (heading * 10) + (input_buffer[x] - 48);
}
}
}
// debug.print("process_backslash_command: heading:");
// debug.println(heading);
if ((heading >= 0) && (heading < 451)) {
submit_request(AZ, REQUEST_AZIMUTH, (heading * HEADING_MULTIPLIER), 136);
strcpy(return_string,"\\!OKGA");
} else {
strcpy(return_string,"\\!??GA");
}
}
if ((input_buffer[2] == 'G') && (input_buffer[3] == 'E')) { // \?GExxx.x - go to EL
#ifdef FEATURE_ELEVATION_CONTROL
heading = 0;
for (int x = 4;x < input_buffer_index;x++){
if(input_buffer[x] == '.'){
hit_decimal = 10;
} else {
if (hit_decimal > 0){
heading = heading + ((float)(input_buffer[x] - 48) / (float)hit_decimal);
hit_decimal = hit_decimal * 10;
} else {
heading = (heading * 10) + (input_buffer[x] - 48);
}
}
}
// debug.print("process_backslash_command: heading:");
// debug.println(heading);
if ((heading >= 0) && (heading < 181)) {
submit_request(EL, REQUEST_ELEVATION, (heading * HEADING_MULTIPLIER), 37);
strcpy(return_string,"\\!OKGE");
} else {
strcpy(return_string,"\\!??GE");
}
#else
strcpy(return_string,"\\!OKGE");
#endif // #FEATURE_ELEVATION_CONTROL
}
if (input_buffer_index == 9) {
if ((input_buffer[2] == 'G') && (input_buffer[3] == 'A')) { // \?GAxxx.x - go to AZ xxx.x
heading = ((input_buffer[4] - 48) * 100.) + ((input_buffer[5] - 48) * 10.) + (input_buffer[6] - 48.) + ((input_buffer[8] - 48) / 10.);
if (((heading >= 0) && (heading < 451)) && (input_buffer[7] == '.')) {
submit_request(AZ, REQUEST_AZIMUTH, (heading * HEADING_MULTIPLIER), 136);
strcpy(return_string,"\\!OKGA");
} else {
strcpy(return_string,"\\!??GA");
}
}
if ((input_buffer[2] == 'G') && (input_buffer[3] == 'E')) { // \?GExxx.x - go to EL
#ifdef FEATURE_ELEVATION_CONTROL
heading = ((input_buffer[4] - 48) * 100.) + ((input_buffer[5] - 48) * 10.) + (input_buffer[5] - 48) + ((input_buffer[8] - 48) / 10.);
if (((heading >= 0) && (heading < 181)) && (input_buffer[7] == '.')) {
submit_request(EL, REQUEST_ELEVATION, (heading * HEADING_MULTIPLIER), 37);
strcpy(return_string,"\\!OKGE");
} else {
strcpy(return_string,"\\!??GE");
}
#else
strcpy(return_string,"\\!OKGE");
#endif // #FEATURE_ELEVATION_CONTROL
}
// if ((input_buffer[2] == 'G') && (input_buffer[3] == 'A')) { // \?GAxxx.x - go to AZ xxx.x
// heading = ((input_buffer[4] - 48) * 100.) + ((input_buffer[5] - 48) * 10.) + (input_buffer[6] - 48.) + ((input_buffer[8] - 48) / 10.);
// if (((heading >= 0) && (heading < 451)) && (input_buffer[7] == '.')) {
// submit_request(AZ, REQUEST_AZIMUTH, (heading * HEADING_MULTIPLIER), 136);
// strcpy(return_string,"\\!OKGA");
// } else {
// strcpy(return_string,"\\!??GA");
// }
// }
// if ((input_buffer[2] == 'G') && (input_buffer[3] == 'E')) { // \?GExxx.x - go to EL
// #ifdef FEATURE_ELEVATION_CONTROL
// heading = ((input_buffer[4] - 48) * 100.) + ((input_buffer[5] - 48) * 10.) + (input_buffer[5] - 48) + ((input_buffer[8] - 48) / 10.);
// if (((heading >= 0) && (heading < 181)) && (input_buffer[7] == '.')) {
// submit_request(EL, REQUEST_ELEVATION, (heading * HEADING_MULTIPLIER), 37);
// strcpy(return_string,"\\!OKGE");
// } else {
// strcpy(return_string,"\\!??GE");
// }
// #else
// strcpy(return_string,"\\!OKGE");
// #endif // #FEATURE_ELEVATION_CONTROL
// }
if ((input_buffer[2] == 'A') && (input_buffer[3] == 'W')) { // \?AWxxyyy - analog pin write; xx = pin #, yyy = value to write (0 - 255)

View File

@ -196,5 +196,17 @@
#define DBG_SERVICE_SUN_TRACKING 253
#define DBG_SERVICE_MOON_TRACKING 254
#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
/* ------end of macros ------- */

View File

@ -60,4 +60,6 @@
// #define DEBUG_A2_ENCODER_LOOPBACK_TEST
// #define DEBUG_QMC5883
// #define DEBUG_ROTATION_STALL_DETECTION
// #define DEBUG_NEXTION_DISPLAY
// #define DEBUG_NEXTION_DISPLAY
// #define DEBUG_NEXTION_DISPLAY_SERIAL_SEND
// #define DEBUG_NEXTION_DISPLAY_SERIAL_RECV

View File

@ -140,6 +140,10 @@
#define CONTROL_PROTOCOL_EMULATION
#endif
#if (defined(OPTION_SAVE_MEMORY_EXCLUDE_EXTENDED_COMMANDS) || defined(OPTION_SAVE_MEMORY_EXCLUDE_BACKSLASH_CMDS)) && defined(FEATURE_NEXTION_DISPLAY)
#error "FEATURE_NEXTION_DISPLAY requires extended commands. Disable OPTION_SAVE_MEMORY_EXCLUDE_EXTENDED_COMMANDS and OPTION_SAVE_MEMORY_EXCLUDE_BACKSLASH_CMDS."
#endif

View File

@ -86,9 +86,8 @@
// #define FEATURE_FABO_LCD_PCF8574_DISPLAY
// #define FEATURE_HD44780_I2C_DISPLAY // Not working yet
// #define FEATURE_NEXTION_DISPLAY // Under Development 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

View File

@ -1,426 +0,0 @@
/* Nextion display settings and macros
Documentation: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display
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);
*/
// Various Settings
#define NEXTION_DISPLAY_UPDATE_MS 500
#define NEXTION_DISPLAY_OVERLAP_UPDATE_MS 1500
#define NEXTION_OBJECT_DISABLE_COLOR 65535 // WHITE
// Page IDs
#define NEXTION_PAGE_MAIN_ID 0
#define NEXTION_PAGE_CONFIGURATION_ID 1
#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.
// Page Main (and global stuff)
#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_TIMER_AZ_ONLY "tmAzOnly" // this timer is enabled to make elevation objects disappear
#define NEXTION_OBJID_TIMER_AZ_ONLY 21
#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_MAIN_TITLE "tTitle"
#define NEXTION_OBJID_MAIN_TITLE 1
#define NEXTION_OBJNAME_STATUS "tStat"
#define NEXTION_OBJID_STATUS 7
#define NEXTION_OBJNAME_STATUS2 "tStat2"
#define NEXTION_OBJID_STATUS2 19
#define NEXTION_OBJNAME_STATUS3 "tStat3"
#define NEXTION_OBJID_STATUS3 18
// Small Azimuth - az / el system
#define NEXTION_OBJNAME_AZIMUTH_LABEL_SMALL "tlblAzSm"
#define NEXTION_OBJID_AZIMUTH_LABEL_SMALL 2
#define NEXTION_OBJNAME_AZIMUTH_VALUE_SMALL "tAzSm"
#define NEXTION_OBJID_AZIMUTH_VALUE_SMALL 3
// Large Azimuth - az only system
#define NEXTION_OBJNAME_AZIMUTH_LABEL_LARGE "tlblAzLg"
#define NEXTION_OBJID_AZIMUTH_LABEL_LARGE 22
#define NEXTION_OBJNAME_AZIMUTH_VALUE_LARGE "tAzLg"
#define NEXTION_OBJID_AZIMUTH_VALUE_LARGE 23
#define NEXTION_OBJNAME_BUTTON_CW "bCW"
#define NEXTION_OBJID_BUTTON_CW 17
#define NEXTION_OBJNAME_BUTTON_CCW "bCCW"
#define NEXTION_OBJID_BUTTON_CCW 4
#define NEXTION_OBJNAME_BUTTON_UP "bUp"
#define NEXTION_OBJID_BUTTON_UP 15
#define NEXTION_OBJNAME_BUTTON_DOWN "bDown"
#define NEXTION_OBJID_BUTTON_DOWN 16
#define NEXTION_OBJNAME_BUTTON_STOP "bSTOP"
#define NEXTION_OBJID_BUTTON_STOP 5
#define NEXTION_OBJNAME_ELEVATION_LABEL "tlblEl"
#define NEXTION_OBJID_ELEVATION_LABEL 13
#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_CLOCK "tClk"
#define NEXTION_OBJID_CLOCK 8
#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
#if defined(NEXTION_OBJNAME_STATUS2) && defined(NEXTION_OBJID_STATUS2)
NexText tStatus2 = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_STATUS2, NEXTION_OBJNAME_STATUS2);
#endif
#if defined(NEXTION_OBJNAME_STATUS3) && defined(NEXTION_OBJID_STATUS3)
NexText tStatus3 = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_STATUS3, NEXTION_OBJNAME_STATUS3);
#endif
#if defined(NEXTION_OBJNAME_GPS) && defined(NEXTION_OBJID_GPS)
NexText tGPS = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_GPS, NEXTION_OBJNAME_GPS);
#endif
#if defined(NEXTION_OBJNAME_CLOCK) && defined(NEXTION_OBJID_CLOCK)
NexText tClock = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_CLOCK, NEXTION_OBJNAME_CLOCK);
#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
#if defined(NEXTION_OBJNAME_ELEVATION_VALUE) && defined(NEXTION_OBJID_ELEVATION_VALUE)
NexText tElValue = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_ELEVATION_VALUE, NEXTION_OBJNAME_ELEVATION_VALUE);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_CW) && defined(NEXTION_OBJID_BUTTON_CW)
NexButton bCW = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_BUTTON_CW, NEXTION_OBJNAME_BUTTON_CW);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW)
NexButton bCCW = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_BUTTON_CCW, NEXTION_OBJNAME_BUTTON_CCW);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_UP) && defined(NEXTION_OBJID_BUTTON_UP)
NexButton bUp = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_BUTTON_UP, NEXTION_OBJNAME_BUTTON_UP);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_DOWN) && defined(NEXTION_OBJID_BUTTON_DOWN)
NexButton bDown = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_BUTTON_DOWN, NEXTION_OBJNAME_BUTTON_DOWN);
#endif
#if defined(NEXTION_OBJNAME_BUTTON_STOP) && defined(NEXTION_OBJID_BUTTON_STOP)
NexButton bSTOP = NexButton(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_BUTTON_STOP, NEXTION_OBJNAME_BUTTON_STOP);
#endif
#if defined(NEXTION_OBJNAME_GRID) && defined(NEXTION_OBJID_GRID)
NexText tGrid = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_GRID, NEXTION_OBJNAME_GRID);
#endif
#if defined(NEXTION_OBJNAME_COORDINATES) && defined(NEXTION_OBJID_COORDINATES)
NexText tCoordinates = NexText(NEXTION_PAGE_MAIN_ID, NEXTION_OBJID_COORDINATES, NEXTION_OBJNAME_COORDINATES);
#endif
#if defined(NEXTION_OBJID_CODEVERSION) && defined(NEXTION_OBJNAME_CODEVERSION)
NexText tCV = NexText(NEXTION_PAGE_ABOUT_ID, NEXTION_OBJID_CODEVERSION, NEXTION_OBJNAME_CODEVERSION);
#endif
// Diagnostics Page
#if defined(NEXTION_OBJNAME_DIAGWINDOW) && defined(NEXTION_OBJID_DIAGWINDOW)
NexText tDiag = NexText(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_OBJID_DIAGWINDOW, NEXTION_OBJNAME_DIAGWINDOW);
#endif
// Data Entry Page
#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"
#define NEXTION_OBJNAME_BUTTON_NEXT "bNext"
#define NEXTION_OBJID_PAGE_MAIN_BUTTON_BACK 12
#define NEXTION_OBJID_PAGE_MAIN_BUTTON_NEXT 11
#define NEXTION_OBJID_PAGE_CONFIGURATION_BUTTON_BACK 1
#define NEXTION_OBJID_PAGE_CONFIGURATION_BUTTON_NEXT 2
#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_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);
NexButton bBackPageDiagnostics = NexButton(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_OBJID_PAGE_DIAGNOSTICS_BUTTON_BACK, NEXTION_OBJNAME_BUTTON_BACK);
NexButton bNextPageDiagnostics = NexButton(NEXTION_PAGE_DIAGNOSTICS_ID, NEXTION_OBJID_PAGE_DIAGNOSTICS_BUTTON_NEXT, NEXTION_OBJNAME_BUTTON_NEXT);
NexButton bBackPageAbout = NexButton(NEXTION_PAGE_ABOUT_ID, NEXTION_OBJID_PAGE_ABOUT_BUTTON_BACK, NEXTION_OBJNAME_BUTTON_BACK);
NexButton bNextPageAbout = NexButton(NEXTION_PAGE_ABOUT_ID, NEXTION_OBJID_PAGE_ABOUT_BUTTON_NEXT, NEXTION_OBJNAME_BUTTON_NEXT);
// Pages
NexPage pageMain = NexPage(NEXTION_PAGE_MAIN_ID, 0, "Main");
NexPage pageConfiguration = NexPage(NEXTION_PAGE_CONFIGURATION_ID, 0, "Configuration");
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[] = {
#if defined(NEXTION_OBJNAME_BUTTON_CW) && defined(NEXTION_OBJID_BUTTON_CW)
&bCW,
#endif
#if defined(NEXTION_OBJNAME_BUTTON_CCW) && defined(NEXTION_OBJID_BUTTON_CCW)
&bCCW,
#endif
#if defined(NEXTION_OBJNAME_BUTTON_STOP) && defined(NEXTION_OBJID_BUTTON_STOP)
&bSTOP,
#endif
#if defined(NEXTION_OBJNAME_BUTTON_DOWN) && defined(NEXTION_OBJID_BUTTON_DOWN)
&bDown,
#endif
#if defined(NEXTION_OBJNAME_BUTTON_UP) && defined(NEXTION_OBJID_BUTTON_UP)
&bUp,
#endif
#if defined(NEXTION_OBJNAME_DATAENT_CANCEL) && defined(NEXTION_OBJNAME_DATAENT_CANCEL)
&bDataEntryCancel,
#endif
#if defined(NEXTION_OBJNAME_DATAENT_ENTER) && defined(NEXTION_OBJID_DATAENT_ENTER)
&bDataEntryEnter,
#endif
#if defined(NEXTION_OBJNAME_DATAENT_DEL) && defined(NEXTION_OBJID_DATAENT_DEL)
&bDataEntryDelete,
#endif
#if defined(NEXTION_OBJNAME_DATAENT_SEPERATOR) && defined(NEXTION_OBJID_DATAENT_SEPERATOR)
&bDataEntrySeperator,
#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,
&bNextPageConfiguration,
&bBackPageDiagnostics,
&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

View File

@ -1,636 +0,0 @@
/* 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 // This is the page ID where all the API global variables are defined
#define NEXTION_API_VERSION 2020041201 // This API version
//-----------------------------------------------------------------------------------------------------------------------------
/*
API Version Declaration
*/
// 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"
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
/*
Rotator Controller and Nextion Unit System States
*/
// 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
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
/*
Rotator Controller to Nextion Command
*/
// 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 [32]
// 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 [32]
// 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 [32]
// 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"
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
/*
Nextion to Rotator Controller Command
*/
// 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_KILL_ALL 4
#define NEXTION_API_RC_COMMAND_KILL_AZ 5
#define NEXTION_API_RC_COMMAND_KILL_EL 6
#define NEXTION_API_RC_COMMAND_ROTATE_CCW 7
#define NEXTION_API_RC_COMMAND_ROTATE_CW 8
#define NEXTION_API_RC_COMMAND_UP 9
#define NEXTION_API_RC_COMMAND_DOWN 10
#define NEXTION_API_RC_COMMAND_ROTATE_AZ_REAL_TO 20
#define NEXTION_API_RC_COMMAND_ROTATE_AZ_RAW_TO 21
#define NEXTION_API_RC_COMMAND_ROTATE_EL_TO 22
#define NEXTION_API_RC_COMMAND_PARK 23
#define NEXTION_API_RC_COMMAND_LONG_PATH 24
#define NEXTION_API_RC_COMMAND_MOON_TRACK 25
#define NEXTION_API_RC_COMMAND_SUN_TRACK 26
#define NEXTION_API_RC_COMMAND_DISENGAGE_BRAKE_AZ 50
#define NEXTION_API_RC_COMMAND_ENGAGE_BRAKE_AZ 51
#define NEXTION_API_RC_COMMAND_DISENGAGE_BRAKE_EL 52
#define NEXTION_API_RC_COMMAND_ENGAGE_BRAKE_EL 53
#define NEXTION_API_RC_COMMAND_AUTOPARK_ENABLE 60
#define NEXTION_API_RC_COMMAND_AUTOPARK_DISABLE 61
#define NEXTION_API_RC_COMMAND_AUTOPARK_SET_TIMER 62
#define NEXTION_API_RC_COMMAND_CALIB_AZ_OFFSET 100
#define NEXTION_API_RC_COMMAND_CALIB_AZ_FULLSCALE 101
#define NEXTION_API_RC_COMMAND_CALIB_EL_0 102
#define NEXTION_API_RC_COMMAND_CALIB_EL_180 103
#define NEXTION_API_RC_COMMAND_CALIB_AZ_EL_MOON 104
#define NEXTION_API_RC_COMMAND_CALIB_AZ_EL_SUN 105
#define NEXTION_API_RC_COMMAND_MAN_SET_AZ 110
#define NEXTION_API_RC_COMMAND_MAN_SET_EL 111
#define NEXTION_API_RC_COMMAND_AZ_SET_START 120
#define NEXTION_API_RC_COMMAND_AZ_SET_CAPABILITY 121
#define NEXTION_API_RC_COMMAND_SET_PIN_HIGH 200
#define NEXTION_API_RC_COMMAND_SET_PIN_LOW 201
#define NEXTION_API_RC_COMMAND_SET_PIN_PWM 202
#define NEXTION_API_RC_COMMAND_SET_PIN_TONE 203
#define NEXTION_API_RC_COMMAND_SET_PIN_NOTONE 204
#define NEXTION_API_RC_COMMAND_SET_CLOCK 220
#define NEXTION_API_RC_COMMAND_SET_CLOCK_OFFSET 221
#define NEXTION_API_RC_COMMAND_REBOOT 255
// 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 [32]
// 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 [32]
// 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 [32]
// 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"
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
/*
Static / Configuration Items
These are typically set at runtime initialization
*/
// DESCRIPTION: System Capabilities
// DATATYPE: Numeric
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Set the supported capabilities
// DATA FORMAT: Bitmapped (see bit definitions below)
#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
// DESCRIPTION: Rotator Controller Code Version
// DATATYPE: String [13]
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Provide rotator controller code version to Nextion unit
// EXAMPLE: 2020.04.06.01
#define NEXTION_API_SYSTEM_RC_CODE_VERSION_OBJECT_ID 20
#define NEXTION_API_SYSTEM_RC_CODE_OBJECT_NAME "v020RCVersion"
// DESCRIPTION: Azimuth Starting Point
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Stores the azimuth starting point in degrees. This is a stright integer with no multiplier.
// TYPICAL VAL: 0 or 180
#define NEXTION_API_AZ_SP_OBJECT_ID 21
#define NEXTION_API_AZ_SP_OBJECT_NAME "v021AzSP"
// DESCRIPTION: Azimuth Rotation Capability
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Stores the azimuth rotation capability in degrees. This is a stright integer with no multiplier.
// TYPICAL VAL: 360 or 450
#define NEXTION_API_AZ_RC_OBJECT_ID 22
#define NEXTION_API_AZ_RC_OBJECT_NAME "v022AzRP"
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
// 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 23
#define NEXTION_API_AZ_OBJECT_NAME "v023Az"
// 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 24
#define NEXTION_API_RAW_AZ_OBJECT_NAME "v024AzRaw"
// 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 25
#define NEXTION_API_EL_OBJECT_NAME "v025El"
// DESCRIPTION: Azimuth Detailed State
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current state of azimuthal rotation
#define NEXTION_API_AZ_STATE_DETAILED_OBJECT_ID 26
#define NEXTION_API_AZ_STATE_DETAILED_OBJECT_NAME "v026AzStDet"
// az_state - uses the same defines from rotator.h
// #define IDLE 0
// #define SLOW_START_CW 1
// #define SLOW_START_CCW 2
// #define NORMAL_CW 3
// #define NORMAL_CCW 4
// #define SLOW_DOWN_CW 5
// #define SLOW_DOWN_CCW 6
// #define INITIALIZE_SLOW_START_CW 7
// #define INITIALIZE_SLOW_START_CCW 8
// #define INITIALIZE_TIMED_SLOW_DOWN_CW 9
// #define INITIALIZE_TIMED_SLOW_DOWN_CCW 10
// #define TIMED_SLOW_DOWN_CW 11
// #define TIMED_SLOW_DOWN_CCW 12
// #define INITIALIZE_DIR_CHANGE_TO_CW 13
// #define INITIALIZE_DIR_CHANGE_TO_CCW 14
// #define INITIALIZE_NORMAL_CW 15
// #define INITIALIZE_NORMAL_CCW 16
// DESCRIPTION: Elevation Detailed State
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current state of elvation rotation
#define NEXTION_API_EL_STATE_DETAILED_OBJECT_ID 27
#define NEXTION_API_EL_STATE_DETAILED_OBJECT_NAME "v027ElStDet"
// el_state - uses the same defines from rotator.h
// #define IDLE 0
// #define SLOW_START_UP 1
// #define SLOW_START_DOWN 2
// #define NORMAL_UP 3
// #define NORMAL_DOWN 4
// #define SLOW_DOWN_DOWN 5
// #define SLOW_DOWN_UP 6
// #define INITIALIZE_SLOW_START_UP 7
// #define INITIALIZE_SLOW_START_DOWN 8
// #define INITIALIZE_TIMED_SLOW_DOWN_UP 9
// #define INITIALIZE_TIMED_SLOW_DOWN_DOWN 10
// #define TIMED_SLOW_DOWN_UP 11
// #define TIMED_SLOW_DOWN_DOWN 12
// #define INITIALIZE_DIR_CHANGE_TO_UP 13
// #define INITIALIZE_DIR_CHANGE_TO_DOWN 14
// #define INITIALIZE_NORMAL_UP 15
// #define INITIALIZE_NORMAL_DOWN 16
// DESCRIPTION: Azimuth Overall State
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current state of azimuthal rotation
#define NEXTION_API_AZ_STATE_OBJECT_ID 28
#define NEXTION_API_AZ_STATE_OBJECT_NAME "v028AzState"
// states - same ones defined in rotator.h
// #define NOT_DOING_ANYTHING 0
// #define ROTATING_CW 1
// #define ROTATING_CCW 2
// DESCRIPTION: Elevation Overall State
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current state of elevation rotation
#define NEXTION_API_EL_STATE_OBJECT_ID 29
#define NEXTION_API_EL_STATE_OBJECT_NAME "v029ElState"
// states - same ones defined in rotator.h
// #define NOT_DOING_ANYTHING 0
// #define ROTATING_UP 3
// #define ROTATING_DOWN 4
// DESCRIPTION: Clock Hours
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current Arduino clock hours
#define NEXTION_API_CLK_H_OBJECT_ID 30
#define NEXTION_API_CLK_H_OBJECT_NAME "v030ClkH"
// DESCRIPTION: Clock Minutes
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current Arduino clock minutes
#define NEXTION_API_CLK_M_OBJECT_ID 31
#define NEXTION_API_CLK_M_OBJECT_NAME "v031ClkM"
// DESCRIPTION: Clock Seconds
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current Arduino clock seconds
#define NEXTION_API_CLK_S_OBJECT_ID 32
#define NEXTION_API_CLK_S_OBJECT_NAME "v032ClkS"
// DESCRIPTION: Clock Time Zone Offset
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current Arduino clock time zone offse
// DATA FORMAT: Offset hours multiplied by 100 (i.e. 1 hour offset = 100, -5 hour offset = -500, -7.5 hour offset = -7500)
#define NEXTION_API_CLK_TIMEZONE_OBJECT_ID 33
#define NEXTION_API_CLK_TIMEZONE_OBJECT_NAME "v033ClkTZ"
// DESCRIPTION: Grid Locator
// DATATYPE: String [6]
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current grid locator
// EXAMPLE: FN20dw
#define NEXTION_API_GRID_OBJECT_ID 34
#define NEXTION_API_GRID_OBJECT_NAME "v034Grid"
// DESCRIPTION: GPS Coordinates Latitude
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current GPS Latitude
// DATA FORMAT: Decimal degrees multiplied by 100000 (i.e. 45.1234 degrees = 4512340, -105.12345 degrees = -10512345)
#define NEXTION_API_GPS_LAT_OBJECT_ID 35
#define NEXTION_API_GPS_LAT_OBJECT_NAME "v035GPSLat"
// DESCRIPTION: GPS Coordinates Longitude
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current GPS Longitude
// DATA FORMAT: Decimal degrees multiplied by 100000 (i.e. 45.1234 degrees = 4512340, -105.12345 degrees = -10512345)
#define NEXTION_API_GPS_LONG_OBJECT_ID 36
#define NEXTION_API_GPS_LONG_OBJECT_NAME "v036GPSLong"
// DESCRIPTION: GPS Elevation
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: The current GPS Longitude in meters
// DATA FORMAT: Decimal degrees multiplied by 100 (i.e. 450 meters = 45000)
#define NEXTION_API_GPS_ELE_OBJECT_ID 37
#define NEXTION_API_GPS_ELE_OBJECT_NAME "v037GPSEl"
// DESCRIPTION: Tracking, Braking, Parking, Indicator State
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Moon and Sun Tracking
// DATA FORMAT: Bitmapped
#define NEXTION_API_TRACKING_STATE_OBJECT_ID 38
#define NEXTION_API_TRACKING_STATE_OBJECT_NAME "v038Track"
// bits
#define NEXTION_STATE_TRACKING_MOON_TRACKING_ON 1
#define NEXTION_STATE_TRACKING_SUN_TRACKING_ON 4
#define NEXTION_STATE_TRACKING_PARK_INITIATED 8
#define NEXTION_STATE_TRACKING_PARKED 16
#define NEXTION_STATE_TRACKING_BRAKE_AZ_ENGAGED 32
#define NEXTION_STATE_TRACKING_BRAKE_EL_ENGAGED 64
#define NEXTION_STATE_TRACKING_OVERLAP 128
// DESCRIPTION: API Variable Change Flags
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: For the Rotator Controller to flag variables that have changed and give refresh hints to the Nextion display
// DATA FORMAT: Bitmapped; The Nextion unit sets this to 0 after it has done a refresh cycle
// NOTE: Use of this by the Nextion display and resetting it to 0 is optional.
#define NEXTION_API_CHANGE_FLAG_OBJECT_ID 39
#define NEXTION_API_CHANGE_FLAG_OBJECT_NAME "v039ChFlag"
#define NEXTION_API_CHANGE_FLAG_AZ 1
#define NEXTION_API_CHANGE_FLAG_EL 2
#define NEXTION_API_CHANGE_FLAG_GPS_SATS 4
#define NEXTION_API_CHANGE_FLAG_CLOCK 8
#define NEXTION_API_CHANGE_FLAG_COORDINATES_ELEVATION 16
#define NEXTION_API_CHANGE_FLAG_MOON_HEADING 32
#define NEXTION_API_CHANGE_FLAG_SUN_HEADING 64
// DESCRIPTION: Moon Azimuth
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Stores the current real azimuth (0 - 360 degrees) of the moon. Since the Nextion only handles integers,
// this is the azimuth * 1000
#define NEXTION_AZ_MOON_OBJECT_ID 40
#define NEXTION_API_AZ_MOON_OBJECT_NAME "v040AzMoon"
// DESCRIPTION: Moon Elevation
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Stores the current elevation (0 - 180 degrees) of the moon. Since the Nextion only handles integers,
// this is the elevation * 1000
#define NEXTION_EL_MOON_OBJECT_ID 41
#define NEXTION_API_EL_MOON_OBJECT_NAME "v041ElMoon"
// DESCRIPTION: Sun Azimuth
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Stores the current real azimuth (0 - 360 degrees) of the sun. Since the Nextion only handles integers,
// this is the azimuth * 1000
#define NEXTION_AZ_SUN_OBJECT_ID 42
#define NEXTION_API_AZ_SUN_OBJECT_NAME "v042AzSun"
// DESCRIPTION: Sun Elevation
// DATATYPE: Number
// DATA FLOW: Rotator Controller -> Nextion
// PURPOSE: Stores the current elevation (0 - 180 degrees) of the sun. Since the Nextion only handles integers,
// this is the elevation * 1000
#define NEXTION_EL_SUN_OBJECT_ID 43
#define NEXTION_API_EL_SUN_OBJECT_NAME "v043ElSun"
NexVariable vNextionAPIVersion = NexVariable(NEXTION_API_PAGE_ID, NEXTION_API_NEXTION_API_VERSION_OBJECT_ID, NEXTION_API_NEXTION_API_VERSION_OBJECT_NAME);
NexVariable vNextionRCAPIVersion = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_ROTATOR_CONTROLLER_API_VERSION_OBJECT_ID,NEXTION_API_ROTATOR_CONTROLLER_API_VERSION_OBJECT_NAME);
NexVariable vNextionNxState = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_STATE_OBJECT_ID,NEXTION_API_NEXTION_STATE_OBJECT_NAME);
NexVariable vNextionRCState = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_STATE_OBJECT_ID,NEXTION_API_RC_STATE_OBJECT_NAME);
NexVariable vNextionNxCmd = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMAND_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_OBJECT_NAME);
NexVariable vNextionNxCmdArgNum1 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMANDN_NUM_ARG1_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_NUM_ARG1_OBJECT_NAME);
NexVariable vNextionNxCmdArgNum2 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMAND_NUM_ARG2_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_NUM_ARG2_OBJECT_NAME);
NexVariable vNextionNxCmdArgNum3 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMAND_NUM_ARG3_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_NUM_ARG3_OBJECT_NAME);
NexVariable vNextionNxCmdArgStr1 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMAND_STR_ARG1_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_STR_ARG1_OBJECT_NAME);
NexVariable vNextionNxCmdArgStr2 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMAND_STR_ARG2_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_STR_ARG2_OBJECT_NAME);
NexVariable vNextionNxCmdArgStr3 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_NEXTION_COMMAND_STR_ARG3_OBJECT_ID,NEXTION_API_NEXTION_COMMAND_STR_ARG3_OBJECT_NAME);
NexVariable vNextionRCCmd = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_OBJECT_ID,NEXTION_API_RC_COMMAND_OBJECT_NAME);
NexVariable vNextionRCCmdArgNum1 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_NUM_ARG1_OBJECT_ID,NEXTION_API_RC_COMMAND_NUM_ARG1_OBJECT_NAME);
NexVariable vNextionRCCmdArgNum2 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_NUM_ARG2_OBJECT_ID,NEXTION_API_RC_COMMAND_NUM_ARG2_OBJECT_NAME);
NexVariable vNextionRCCmdArgNum3 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_NUM_ARG3_OBJECT_ID,NEXTION_API_RC_COMMAND_NUM_ARG3_OBJECT_NAME);
NexVariable vNextionRCCmdStrNum1 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_STR_ARG1_OBJECT_ID,NEXTION_API_RC_COMMAND_STR_ARG1_OBJECT_NAME);
NexVariable vNextionRCCmdStrNum2 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_STR_ARG2_OBJECT_ID,NEXTION_API_RC_COMMAND_STR_ARG2_OBJECT_NAME);
NexVariable vNextionRCCmdStrNum3 = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RC_COMMAND_STR_ARG3_OBJECT_ID,NEXTION_API_RC_COMMAND_STR_ARG3_OBJECT_NAME);
NexVariable vNextionSystemCapabilities = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_SYSTEM_CAPABILITIES_OBJECT_ID,NEXTION_API_SYSTEM_CAPABILITIES_OBJECT_NAME);
NexVariable vNextionRCCodeVersion = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_SYSTEM_RC_CODE_VERSION_OBJECT_ID,NEXTION_API_SYSTEM_RC_CODE_OBJECT_NAME);
NexVariable vNextionAzStartingPoint = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_AZ_SP_OBJECT_ID,NEXTION_API_AZ_SP_OBJECT_NAME);
NexVariable vNextionAzRotationCapability = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_AZ_RC_OBJECT_ID,NEXTION_API_AZ_RC_OBJECT_NAME);
NexVariable vNextionAz = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_AZ_OBJECT_ID,NEXTION_API_AZ_OBJECT_NAME);
NexVariable vNextionAzRaw = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_RAW_AZ_OBJECT_ID,NEXTION_API_RAW_AZ_OBJECT_NAME);
NexVariable vNextionEl = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_EL_OBJECT_ID,NEXTION_API_EL_OBJECT_NAME);
NexVariable vNextionAzStateDetailed = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_AZ_STATE_DETAILED_OBJECT_ID,NEXTION_API_AZ_STATE_DETAILED_OBJECT_NAME);
NexVariable vNextionElStateDetailed = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_EL_STATE_DETAILED_OBJECT_ID,NEXTION_API_EL_STATE_DETAILED_OBJECT_NAME);
NexVariable vNextionAzState = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_AZ_STATE_OBJECT_ID,NEXTION_API_AZ_STATE_OBJECT_NAME);
NexVariable vNextionElState = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_EL_STATE_OBJECT_ID,NEXTION_API_EL_STATE_OBJECT_NAME);
NexVariable vNextionClockHours = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_CLK_H_OBJECT_ID,NEXTION_API_CLK_H_OBJECT_NAME);
NexVariable vNextionClockMinutes = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_CLK_M_OBJECT_ID,NEXTION_API_CLK_M_OBJECT_NAME);
NexVariable vNextionClockSeconds = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_CLK_S_OBJECT_ID,NEXTION_API_CLK_S_OBJECT_NAME);
NexVariable vNextionClockTimeZoneOffset = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_CLK_TIMEZONE_OBJECT_ID,NEXTION_API_CLK_TIMEZONE_OBJECT_NAME);
NexVariable vNextionGrid = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_GRID_OBJECT_ID,NEXTION_API_GRID_OBJECT_NAME);
NexVariable vNextionGPSLatitude = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_GPS_LAT_OBJECT_ID,NEXTION_API_GPS_LAT_OBJECT_NAME);
NexVariable vNextionGPSLongitude = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_GPS_LONG_OBJECT_ID,NEXTION_API_GPS_LONG_OBJECT_NAME);
NexVariable vNextionGPSElevation = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_GPS_ELE_OBJECT_ID,NEXTION_API_GPS_ELE_OBJECT_NAME);
NexVariable vNextionTrackingAndIndicators = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_TRACKING_STATE_OBJECT_ID,NEXTION_API_TRACKING_STATE_OBJECT_NAME);
NexVariable vNextionChangeFlags = NexVariable(NEXTION_API_PAGE_ID,NEXTION_API_CHANGE_FLAG_OBJECT_ID,NEXTION_API_CHANGE_FLAG_OBJECT_NAME);
NexVariable vNextionMoonAz = NexVariable(NEXTION_API_PAGE_ID,NEXTION_AZ_MOON_OBJECT_ID,NEXTION_API_AZ_MOON_OBJECT_NAME);
NexVariable vNextionMoonEl = NexVariable(NEXTION_API_PAGE_ID,NEXTION_EL_MOON_OBJECT_ID,NEXTION_API_EL_MOON_OBJECT_NAME);
NexVariable vNextionSunAz = NexVariable(NEXTION_API_PAGE_ID,NEXTION_AZ_SUN_OBJECT_ID,NEXTION_API_AZ_SUN_OBJECT_NAME);
NexVariable vNextionSunEl = NexVariable(NEXTION_API_PAGE_ID,NEXTION_EL_SUN_OBJECT_ID,NEXTION_API_EL_SUN_OBJECT_NAME);

View File

@ -361,6 +361,9 @@ 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 nexSerial Serial3
#define NEXTION_SERIAL_BAUD 115200
// ######## ######## ###### ########
// ## ## ## ## ##