kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_Tracker
add monitor turn-on/off on doubleclick
rodzic
fe2612526b
commit
5cde231e8c
|
@ -22,9 +22,9 @@ OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
|||
HardwareSerial ss(1);
|
||||
TinyGPSPlus gps;
|
||||
|
||||
void setup_gps();
|
||||
void load_config();
|
||||
void setup_lora();
|
||||
void setup_gps();
|
||||
|
||||
String create_lat_aprs(RawDegrees lat);
|
||||
String create_long_aprs(RawDegrees lng);
|
||||
|
@ -37,6 +37,7 @@ String getSmartBeaconState();
|
|||
String padding(unsigned int number, unsigned int width);
|
||||
|
||||
static bool send_update = true;
|
||||
static bool display_toggle_value = true;
|
||||
|
||||
static void handle_tx_click() {
|
||||
send_update = true;
|
||||
|
@ -47,6 +48,14 @@ static void handle_next_beacon() {
|
|||
show_display(BeaconMan.getCurrentBeaconConfig()->callsign, BeaconMan.getCurrentBeaconConfig()->message, 2000);
|
||||
}
|
||||
|
||||
static void toggle_display() {
|
||||
display_toggle_value = !display_toggle_value;
|
||||
display_toggle(display_toggle_value);
|
||||
if (display_toggle_value == true) {
|
||||
setup_display();
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
@ -68,7 +77,7 @@ void setup() {
|
|||
logPrintlnI("LoRa APRS Tracker by OE5BPA (Peter Buchegger)");
|
||||
setup_display();
|
||||
|
||||
show_display("OE5BPA", "LoRa APRS Tracker", "by Peter Buchegger", 2000);
|
||||
show_display("DK4KP-7", "LoRa APRS Tracker", "by Peter Buchegger", 2000);
|
||||
load_config();
|
||||
|
||||
setup_gps();
|
||||
|
@ -91,6 +100,7 @@ void setup() {
|
|||
if (Config.button.alt_message) {
|
||||
userButton.attachLongPressStart(handle_next_beacon);
|
||||
}
|
||||
userButton.attachDoubleClick(toggle_display);
|
||||
|
||||
logPrintlnI("Smart Beacon is " + getSmartBeaconState());
|
||||
show_display("INFO", "Smart Beacon is " + getSmartBeaconState(), 1000);
|
||||
|
@ -105,7 +115,7 @@ void loop() {
|
|||
if (Config.debug) {
|
||||
while (Serial.available() > 0) {
|
||||
char c = Serial.read();
|
||||
// Serial.print(c);
|
||||
//Serial.print(c);
|
||||
gps.encode(c);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -9,6 +9,16 @@
|
|||
|
||||
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
|
||||
|
||||
void display_toggle(bool toggle) {
|
||||
logPrintlnI("Toggling display");
|
||||
logPrintlnI(toggle ? "On" : "Off");
|
||||
if (toggle == false) {
|
||||
display.ssd1306_command(SSD1306_DISPLAYOFF);
|
||||
} else {
|
||||
display.ssd1306_command(SSD1306_DISPLAYON);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void setup_display() {
|
||||
pinMode(OLED_RST, OUTPUT);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#define DISPLAY_H_
|
||||
|
||||
void setup_display();
|
||||
void display_toggle(bool toggle);
|
||||
|
||||
void show_display(String header, int wait = 0);
|
||||
void show_display(String header, String line1, int wait = 0);
|
||||
|
|
Ładowanie…
Reference in New Issue