Fixing menus.
This commit is contained in:
@@ -41,16 +41,13 @@ void one(); // Menu one
|
||||
void two(); // Menu two
|
||||
void three(); // Menu three
|
||||
void four(); // Menu four
|
||||
void five(); // Menu five
|
||||
void read_serial(); // Menu that reads the serial
|
||||
void write_gps(); // Menu that writes gps out to serial
|
||||
void write_hdg(); // Menu that writes hdg out to serial
|
||||
void write_wnd(); // Menu that writes wnd out to serial
|
||||
void write_dep(); // Menu that writes dep out to serial
|
||||
void batt_icon(); // Draws the battery icon acording to value
|
||||
|
||||
void write_serial(); // Menu that writes to serial
|
||||
void config_nmm(); // Configuration menu
|
||||
|
||||
|
||||
|
||||
@@ -141,9 +138,6 @@ ISR(TIMER1_COMPA_vect) //
|
||||
else if (menuState == 4) {
|
||||
menuState = 3;
|
||||
}
|
||||
else if (menuState == 5) {
|
||||
menuState = 4;
|
||||
}
|
||||
while (!rUP); // Check if button is still pressed do nothing
|
||||
}
|
||||
|
||||
@@ -159,10 +153,7 @@ ISR(TIMER1_COMPA_vect) //
|
||||
menuState = 4;
|
||||
}
|
||||
else if (menuState == 4) {
|
||||
menuState = 5;
|
||||
}
|
||||
else if (menuState == 5) {
|
||||
menuState = 5;
|
||||
menuState = 4;
|
||||
}
|
||||
while (!rDOWN); // Check if button is still pressed do nothing
|
||||
}
|
||||
@@ -185,10 +176,6 @@ ISR(TIMER1_COMPA_vect) //
|
||||
menuState = 13;
|
||||
prevMenu = 4;
|
||||
}
|
||||
else if (menuState == 5) {
|
||||
menuState = 14;
|
||||
prevMenu = 5;
|
||||
}
|
||||
while (!rOK); // Check if button is still pressed do nothing
|
||||
}
|
||||
|
||||
@@ -206,9 +193,6 @@ ISR(TIMER1_COMPA_vect) //
|
||||
else if (prevMenu == 4) {
|
||||
menuState = 4;
|
||||
}
|
||||
else if (prevMenu == 5) {
|
||||
menuState = 5;
|
||||
}
|
||||
while (!rCANCEL); // Check if button is still pressed do nothing
|
||||
}
|
||||
}
|
||||
@@ -240,27 +224,7 @@ void loop() {
|
||||
mySerial.end();
|
||||
read_s = 0;
|
||||
}
|
||||
else if (menuState == 5) {
|
||||
five();
|
||||
mySerial.end();
|
||||
read_s = 0;
|
||||
}
|
||||
else if (menuState == 10) {
|
||||
if (read_s == 0) {
|
||||
mySerial.begin(4800);
|
||||
read_s = 1;
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,17);
|
||||
display.println("RS-422 to USB");
|
||||
display.println("Sending...");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
read_serial();
|
||||
}
|
||||
else if (menuState == 11) {
|
||||
if (read_s == 0) {
|
||||
mySerial.begin(4800);
|
||||
read_s = 1;
|
||||
@@ -274,13 +238,8 @@ void loop() {
|
||||
}
|
||||
write_gps();
|
||||
}
|
||||
else if (menuState == 12) {
|
||||
config_nmm();
|
||||
mySerial.end();
|
||||
read_s = 0;
|
||||
}
|
||||
else if (menuState == 13) {
|
||||
if (read_s == 0) {
|
||||
else if (menuState == 11) {
|
||||
if (read_s == 0) {
|
||||
mySerial.begin(4800);
|
||||
read_s = 1;
|
||||
display.clearDisplay();
|
||||
@@ -293,7 +252,7 @@ void loop() {
|
||||
}
|
||||
write_hdg();
|
||||
}
|
||||
else if (menuState == 14) {
|
||||
else if (menuState == 12) {
|
||||
if (read_s == 0) {
|
||||
mySerial.begin(4800);
|
||||
read_s = 1;
|
||||
@@ -307,6 +266,21 @@ void loop() {
|
||||
}
|
||||
write_dep();
|
||||
}
|
||||
else if (menuState == 13) {
|
||||
if (read_s == 0) {
|
||||
mySerial.begin(4800);
|
||||
read_s = 1;
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,17);
|
||||
display.println("RS-422 to USB");
|
||||
display.println("Sending...");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
read_serial();
|
||||
}
|
||||
else {
|
||||
one();
|
||||
mySerial.end();
|
||||
@@ -376,16 +350,14 @@ void one (void) {
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,12);
|
||||
display.println("RS422 ==> USB <--");
|
||||
display.setCursor(1,22);
|
||||
display.println("Send NMEA0183");
|
||||
display.println("Send GPS <--");
|
||||
display.setCursor(1,32);
|
||||
display.println("Config NMEA0183");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Heading");
|
||||
display.setCursor(1,52);
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Depth");
|
||||
display.setCursor(1,52);
|
||||
display.println("RS422 ==> USB");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
@@ -395,16 +367,14 @@ void two (void) {
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,12);
|
||||
display.println("RS422 ==> USB");
|
||||
display.setCursor(1,22);
|
||||
display.println("Send NMEA0183 <--");
|
||||
display.println("Send GPS");
|
||||
display.setCursor(1,32);
|
||||
display.println("Config NMEA0183");
|
||||
display.println("Send Heading <--");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Heading");
|
||||
display.setCursor(1,52);
|
||||
display.println("Send Depth");
|
||||
display.setCursor(1,52);
|
||||
display.println("RS422 ==> USB");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
@@ -414,16 +384,14 @@ void three (void) {
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,12);
|
||||
display.println("RS422 ==> USB");
|
||||
display.setCursor(1,22);
|
||||
display.println("Send NMEA0183");
|
||||
display.println("Send GPS");
|
||||
display.setCursor(1,32);
|
||||
display.println("Config NMEA0183 <--");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Heading");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Depth <--");
|
||||
display.setCursor(1,52);
|
||||
display.println("Send Depth");
|
||||
display.println("RS422 ==> USB");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
@@ -433,35 +401,14 @@ void four (void) {
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,12);
|
||||
display.println("RS422 ==> USB");
|
||||
display.setCursor(1,22);
|
||||
display.println("Send NMEA0183");
|
||||
display.println("Send GPS");
|
||||
display.setCursor(1,32);
|
||||
display.println("Config NMEA0183");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Heading <--");
|
||||
display.setCursor(1,52);
|
||||
display.println("Send Depth");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
|
||||
void five (void) {
|
||||
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,12);
|
||||
display.println("RS422 ==> USB");
|
||||
display.setCursor(1,22);
|
||||
display.println("Send NMEA0183");
|
||||
display.setCursor(1,32);
|
||||
display.println("Config NMEA0183");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Heading");
|
||||
display.setCursor(1,42);
|
||||
display.println("Send Depth");
|
||||
display.setCursor(1,52);
|
||||
display.println("Send Depth <--");
|
||||
display.println("RS422 ==> USB <--");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
@@ -473,47 +420,30 @@ void read_serial (void) {
|
||||
}
|
||||
}
|
||||
|
||||
void write_serial (void) {
|
||||
void write_gps (void) {
|
||||
|
||||
mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64");
|
||||
mySerial.println();
|
||||
}
|
||||
|
||||
void config_nmm (void) {
|
||||
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(46,17);
|
||||
display.println("BLOCKED");
|
||||
batt_icon();
|
||||
display.display();
|
||||
}
|
||||
|
||||
void write_gps (void) {
|
||||
|
||||
// mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64");
|
||||
// mySerial.println();
|
||||
mySerial.println("Im a GPS :)");
|
||||
delay(100);
|
||||
}
|
||||
|
||||
void write_hdg (void) {
|
||||
|
||||
// mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64");
|
||||
// mySerial.println();
|
||||
mySerial.println("Im a Gyro :)");
|
||||
}
|
||||
|
||||
void write_wnd (void) {
|
||||
|
||||
// mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64");
|
||||
// mySerial.println();
|
||||
mySerial.println("Im a Wind sensor :)");
|
||||
mySerial.print("$HEHDT,268.4,T*27");
|
||||
mySerial.println();
|
||||
delay(100);
|
||||
}
|
||||
|
||||
void write_dep (void) {
|
||||
|
||||
// mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64");
|
||||
// mySerial.println();
|
||||
mySerial.println("Im an Echo sounder :)");
|
||||
mySerial.print("$SDDBT,0038.0,f,0011.6,M,0006.3,F");
|
||||
mySerial.println();
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user