diff --git a/README.md b/README.md index f509275..24f4675 100755 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# NMEA Monitor 1 -A small portable NMEA0183 comunications monitor. +# NMEA Simulator 1 +A small portable NMEA0183 comunications simulator. diff --git a/firmware/v01/v01.ino b/firmware/v01/v01.ino index 113efc1..39f3c72 100644 --- a/firmware/v01/v01.ino +++ b/firmware/v01/v01.ino @@ -1,7 +1,7 @@ /********************************************************************* NMM-1 -NMEA0183 serial monitor. +NMEA0183 serial simulator. By Jony Silva Wed 24 Jan 23:11:25 GMT 2018 @@ -13,7 +13,6 @@ Wed 24 Jan 23:11:25 GMT 2018 #include #include #include -//#include #define OLED_RESET 8 Adafruit_SSD1306 display(OLED_RESET); @@ -69,7 +68,7 @@ int read_s = 0; void setup() { // BEGIN SETUP ------------------------------------ - // Configure buttons and led's has inputs or outputs + pinMode(led1, OUTPUT); // Led 1 is an output pinMode(led2, OUTPUT); // Led 2 is an output pinMode(UP, INPUT); // Switch 1 is an input @@ -192,19 +191,6 @@ void loop() { batt_val = analogRead(batt); -// Routine to check the battery analog value for calibration -/* display.drawRect(0, 8, 168, 24, BLACK); - display.display(); - display.clearDisplay(); - display.setTextSize(1); - display.setTextColor(WHITE); - display.setCursor(50,18); - display.println(batt_val); - batt_icon(); - display.display();*/ - - - if (menuState == 1) { one(); mySerial.end(); @@ -224,13 +210,30 @@ void loop() { 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) { - write_serial(); - mySerial.end(); - read_s = 0; + if (read_s == 0) { + mySerial.begin(4800); + read_s = 1; + display.clearDisplay(); + display.setTextSize(1); + display.setTextColor(WHITE); + display.setCursor(1,17); + display.println("Sending GPS....."); + batt_icon(); + display.display(); + } + write_serial(); } else if (menuState == 12) { config_nmm(); @@ -307,14 +310,13 @@ void one (void) { display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(1,12); - display.println("Receive NMEA0183 <--"); + display.println("RS422 ==> USB <--"); display.setCursor(1,22); display.println("Send NMEA0183"); display.setCursor(1,32); display.println("Config NMEA0183"); batt_icon(); display.display(); - } void two (void) { @@ -323,14 +325,13 @@ void two (void) { display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(1,12); - display.println("Receive NMEA0183"); + display.println("RS422 ==> USB"); display.setCursor(1,22); display.println("Send NMEA0183 <--"); display.setCursor(1,32); display.println("Config NMEA0183"); batt_icon(); display.display(); - } void three (void) { @@ -339,50 +340,26 @@ void three (void) { display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(1,12); - display.println("Receive NMEA0183"); + display.println("RS422 ==> USB"); display.setCursor(1,22); display.println("Send NMEA0183"); display.setCursor(1,32); display.println("Config NMEA0183 <--"); batt_icon(); display.display(); - } void read_serial (void) { -// display.setTextWrap(false); - - - - - - - if (mySerial.available()) { - Serial.write(mySerial.read()); - } - - - - - - - + if (mySerial.available()) { + Serial.write(mySerial.read()); + } } void write_serial (void) { - display.clearDisplay(); - display.setTextSize(1); - display.setTextColor(WHITE); - display.setCursor(1,17); - display.println("Sending GPS....."); - batt_icon(); - display.display(); -// mySerial.print("$GPGGA,090000.10,6350.37829338,N,02225.18272240,W,1,05,2.87,160.00,M,-21.3213,M,,*64"); -// mySerial.println(); - delay(1000); - + 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) { @@ -394,5 +371,4 @@ void config_nmm (void) { display.println("BLOCKED"); batt_icon(); display.display(); - }