Skip to content

Commit 473da7b

Browse files
author
root
committed
Added clear map button on pin 8
1 parent da85014 commit 473da7b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

gpsTracker_handheldController/gpsTracker_handheldController.ino

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define REQUEST_GPS_ONCE_BUTTON 5
1111
#define REQUEST_GPS_CONTINUOUS_BUTTON 6
1212
#define REQUEST_GPS_STOP_BUTTON 7
13+
#define REDRAW_MAP_BUTTON 8
1314

1415
#define sclk 13 // Don't change
1516
#define mosi 11 // Don't change
@@ -126,6 +127,7 @@ void setup() {
126127
pinMode(REQUEST_GPS_ONCE_BUTTON, INPUT_PULLUP);
127128
pinMode(REQUEST_GPS_CONTINUOUS_BUTTON, INPUT_PULLUP);
128129
pinMode(REQUEST_GPS_STOP_BUTTON, INPUT_PULLUP);
130+
pinMode(REDRAW_MAP_BUTTON, INPUT_PULLUP);
129131

130132
//Serial.begin(1200); //For debugging
131133
ss.begin(1200); //For HC-12 wireless communication module
@@ -172,6 +174,10 @@ void loop() {
172174
if (digitalReadDebounce(REQUEST_GPS_STOP_BUTTON)) {
173175
transmit("gps", "stop");
174176
}
177+
if (digitalReadDebounce(REDRAW_MAP_BUTTON)) {
178+
clearTFTMap(); //Clear the map
179+
drawTFTMap(); //Re-draw the map
180+
}
175181

176182
if (ss.available() > 0) {
177183
digitalWrite(LED_BUILTIN, HIGH);
@@ -268,9 +274,10 @@ void loop() {
268274
tft.print(commacount);
269275
}
270276

271-
clearTFTMap();
272-
drawTFTMap();
273-
displayLocationOnMap(datacsvarray[0].toFloat(), datacsvarray[1].toFloat()); //(latitude, longitude)
277+
clearTFTMap(); //Clear the map
278+
drawTFTMap(); //Re-draw the map
279+
displayLocationOnMap(datacsvarray[0].toFloat(), datacsvarray[1].toFloat()); //Display current location on the map. Arguments are (float latitude, float longitude)
280+
274281
} else if (datatype == "message") {
275282
clearTFTReceived(); //message is written to the same area of the screen as received text, so this is cleared first
276283
setCursorLine(5, 14);
@@ -279,7 +286,7 @@ void loop() {
279286
tft.print(datacsvarray[i]);
280287
tft.print(",");
281288
}*/
282-
delay(1000); //Delay for a second to read message
289+
delay(1000); //Delay for a second so the user can read the message
283290
} else {
284291
//transmit("message", "message datatype not understood");
285292
delay(100); //Do nothing

0 commit comments

Comments
 (0)