diff --git a/firmware/v01/v01.ino b/firmware/v01/v01.ino index ab0efed..284b8a6 100644 --- a/firmware/v01/v01.ino +++ b/firmware/v01/v01.ino @@ -123,57 +123,57 @@ void setup() { // BEGIN SETUP ------------------------------------ // Timer compare interrupt service routine -------------------------- ISR(TIMER1_COMPA_vect) { - if (!rUP) // If button UP pressed + if (!rUP) // If button UP pressed { - if (menuState == 1){} // Do nothing and leave menuState - // as it is (4) + if (menuState == 1){} // Do nothing and leave menuState + // as it is (1) else { menuState--; } - while (!rUP); // Check if button is still pressed do nothing + while (!rUP); // Check if button is still pressed, do nothing } - if (!rDOWN) // If button DOWN pressed + if (!rDOWN) // If button DOWN pressed { - if (menuState == 4){} // Do nothing and leave menuState - // as it is (4) + if (menuState == 4){} // Do nothing and leave menuState + // as it is (4) else { menuState++; } - while (!rDOWN); // Check if button is still pressed do nothing + while (!rDOWN); // Check if button is still pressed, do nothing } - if (!rOK) // If button OK pressed + if (!rOK) // If button OK pressed { - if (menuState == 1) // and the menuState is 1 + if (menuState == 1) // and the menuState is 1 { - prevMenu = menuState; // and set prevMenu to 1 - menuState = 10; // then reset menuState to 10 + prevMenu = menuState; // set prevMenu to 1 + menuState = 10; // then reset menuState to 10 } - else if (menuState == 2) // If menuState is 2 + else if (menuState == 2) // If menuState is 2 { - prevMenu = menuState; // and set prevMenu to 2 - menuState = 11; // then reset menuState to 11 + prevMenu = menuState; // set prevMenu to 2 + menuState = 11; // then reset menuState to 11 } - else if (menuState == 3) // If menuState is 3 + else if (menuState == 3) // If menuState is 3 { - prevMenu = menuState; // and set prevMenu to 3 - menuState = 12; // then reset menuState to 12 + prevMenu = menuState; // set prevMenu to 3 + menuState = 12; // then reset menuState to 12 } - else if (menuState == 4) // If menuState is 4 + else if (menuState == 4) // If menuState is 4 { - prevMenu = menuState; // and set prevMenu to 4 - menuState = 13; // then reset menuState to 13 + prevMenu = menuState; // set prevMenu to 4 + menuState = 13; // then reset menuState to 13 } - while (!rOK); // Check if button is still pressed do nothing + while (!rOK); // Check if button is still pressed, do nothing } - if (!rCANCEL) // If button OK pressed + if (!rCANCEL) // If button CANCEL pressed { - menuState = prevMenu; - while (!rCANCEL); // Check if button is still pressed do nothing + menuState = prevMenu; // set menuState to same value as prevMenu + while (!rCANCEL); // Check if button is still pressed, do nothing } } @@ -422,9 +422,9 @@ void read_serial (void) Serial.write(mySerial.read()); // redirect it to USB } - if (Serial.available()) // If incoming NMEA0183 serial + if (Serial.available()) // If incoming USB serial { - mySerial.write(Serial.read()); // redirect it to USB + mySerial.write(Serial.read()); // redirect it to NMEA0183 serial } } @@ -432,7 +432,7 @@ void write_gps (void) { // Write NMEA0183 GPS sentence to USB mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64"); - mySerial.println(); // Print on display + mySerial.println(); // Send string to NMEA0183 serial delay(100); } @@ -440,7 +440,7 @@ void write_hdg (void) { // Write NMEA0183 Heading sentence to USB mySerial.print("$HEHDT,268.4,T*27"); - mySerial.println(); // Print on display + mySerial.println(); // Send string to NMEA0183 serial delay(100); } @@ -448,6 +448,6 @@ void write_dep (void) { // Write NMEA0183 Depth sentence to USB mySerial.print("$SDDBT,0038.0,f,0011.6,M,0006.3,F"); - mySerial.println(); // Print on display + mySerial.println(); // Send string to NMEA0183 serial delay(100); }