Merge pull request #59 from kornherp/display_toggle
add monitor turn-on/off on doubleclick
This commit is contained in:
commit
0c95ed4e2c
|
@ -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);
|
||||
|
@ -36,7 +36,8 @@ String createTimeString(time_t t);
|
|||
String getSmartBeaconState();
|
||||
String padding(unsigned int number, unsigned int width);
|
||||
|
||||
static bool send_update = true;
|
||||
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) {
|
||||
setup_display();
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
@ -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);
|
||||
|
|
|
@ -33,6 +33,18 @@ void setup_display() {
|
|||
display.display();
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void display_toggle(bool toggle) {
|
||||
logPrintI("Toggling display: ");
|
||||
if (toggle) {
|
||||
logPrintlnI("On");
|
||||
display.ssd1306_command(SSD1306_DISPLAYON);
|
||||
} else {
|
||||
logPrintlnI("Off");
|
||||
display.ssd1306_command(SSD1306_DISPLAYOFF);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void show_display(String header, int wait) {
|
||||
display.clearDisplay();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue