Skip to content

Commit

Permalink
[Trivial][Cleanup] Moved UI Files
Browse files Browse the repository at this point in the history
Moved Display / UI related work under a UI directory
  • Loading branch information
scottyob committed Mar 2, 2025
1 parent 16e9818 commit 2d0fd8a
Show file tree
Hide file tree
Showing 64 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/vario/DebugWebserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <WiFi.h>
#include "SDcard.h"
#include "WebServer.h"
#include "display.h"
#include "ui/display.h"

WebServer server;
String send_buffer = "";
Expand Down
29 changes: 17 additions & 12 deletions src/vario/buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@

#include <Arduino.h>

#include "PageNavigate.h"
#include "PageThermal.h"
#include "PageThermalSimple.h"
#include "PageWarning.h"
#include "baro.h"
#include "display.h"
#include "menu_page.h"
#include "pages.h"
#include "power.h"
#include "settings.h"
#include "speaker.h"
#include "ui/PageNavigate.h"
#include "ui/PageThermal.h"
#include "ui/PageThermalSimple.h"
#include "ui/PageWarning.h"
#include "ui/display.h"
#include "ui/menu_page.h"
#include "ui/pages.h"

// button debouncing
Button button_debounce_last = Button::NONE;
Expand Down Expand Up @@ -63,8 +63,9 @@ Button buttons_init(void) {
// persistent button press.
bool centerHoldLockButtons = true; // default to true, for the first turn on event

// call this function after performing a center-hold button action if no additional center-hold actions
// should be taken until user lets go of the center button (example: resetting timer, then turning off)
// call this function after performing a center-hold button action if no additional center-hold
// actions should be taken until user lets go of the center button (example: resetting timer, then
// turning off)
void buttons_lockAfterHold() {
centerHoldLockButtons = true; // lock from further actions until user lets go of center button
}
Expand All @@ -79,7 +80,7 @@ Button buttons_update(void) {
// executed center-hold event. This prevents multiple sequential actions being executed if user
// keeps holding the center button (i.e., resetting timer, then turning off)
if (centerHoldLockButtons && which_button == Button::CENTER) {
return which_button; // return early without executing further tasks
return which_button; // return early without executing further tasks
} else {
centerHoldLockButtons = false; // user let go of center button, so we can reset the lock.
}
Expand Down Expand Up @@ -224,9 +225,13 @@ Button buttons_update(void) {
return which_button;
}

ButtonState buttons_get_state(void) { return button_state; }
ButtonState buttons_get_state(void) {
return button_state;
}

uint16_t buttons_get_hold_count(void) { return button_hold_counter; }
uint16_t buttons_get_hold_count(void) {
return button_hold_counter;
}

// the recurring call to see if user is pressing buttons. Handles debounce and button state changes
Button buttons_check(void) {
Expand Down
51 changes: 22 additions & 29 deletions src/vario/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

#include "SDcard.h"
#include "baro.h"
#include "display.h"
#include "gpx.h"
#include "log.h"
#include "settings.h"
#include "telemetry.h"
#include "ui/display.h"
#include "wind_estimate/wind_estimate.h"

#define DEBUG_GPS 0
Expand All @@ -41,16 +41,16 @@ uint32_t gpsBootReady = 0;
// Satellite tracking

// GPS satellite info for storing values straight from the GPS
struct gps_sat_info sats[MAX_SATELLITES];
struct gps_sat_info sats[MAX_SATELLITES];

// Cached version of the sat info for showing on display (this will be re-written each time a
// total set of new sat info is available)
struct gps_sat_info satsDisplay[MAX_SATELLITES];
struct gps_sat_info satsDisplay[MAX_SATELLITES];

// $GPGSV sentence parsing
TinyGPSCustom totalGPGSVMessages(gps, "GPGSV", 1); // first element is # messages (N) total
TinyGPSCustom messageNumber(gps, "GPGSV", 2); // second element is message number (x of N)
TinyGPSCustom satsInView(gps, "GPGSV", 3); // third element is # satellites in view
TinyGPSCustom totalGPGSVMessages(gps, "GPGSV", 1); // first element is # messages (N) total
TinyGPSCustom messageNumber(gps, "GPGSV", 2); // second element is message number (x of N)
TinyGPSCustom satsInView(gps, "GPGSV", 3); // third element is # satellites in view

// Fields for capturing the information from GSV strings
// (each GSV sentence will have info for at most 4 satellites)
Expand All @@ -63,8 +63,8 @@ TinyGPSCustom snr[4]; // to be initialized later
// Need to read from the GST sentence which TinyGPS doesn't do by default
TinyGPSCustom latAccuracy(gps, "GPGST", 6); // Latitude error - standard deviation
TinyGPSCustom lonAccuracy(gps, "GPGST", 7); // Longitude error - standard deviation
TinyGPSCustom fix(gps, "GNGGA", 6); // Fix (0=none, 1=GPS, 2=DGPS, 3=Valid PPS)
TinyGPSCustom fixMode(gps, "GNGSA", 2); // Fix mode (1=No fix, 2=2D fix, 3=3D fix)
TinyGPSCustom fix(gps, "GNGGA", 6); // Fix (0=none, 1=GPS, 2=DGPS, 3=Valid PPS)
TinyGPSCustom fixMode(gps, "GNGSA", 2); // Fix mode (1=No fix, 2=2D fix, 3=3D fix)
GPSFixInfo gpsFixInfo;

// Enable GPS Backup Power (to save satellite data and allow faster start-ups)
Expand Down Expand Up @@ -203,8 +203,6 @@ void gps_init(void) {
*/
} // gps_init



float glideRatio;

void gps_calculateGlideRatio() {
Expand All @@ -227,11 +225,10 @@ void gps_updateFixInfo() {
gpsFixInfo.fix = atoi(fix.value());
gpsFixInfo.fixMode = atoi(fixMode.value());


// solution accuracy
//gpsFixInfo.latError = 2.5; //atof(latAccuracy.value());
//gpsFixInfo.lonError = 1.5; //atof(lonAccuracy.value());
//gpsFixInfo.error = sqrt(gpsFixInfo.latError * gpsFixInfo.latError +
// gpsFixInfo.latError = 2.5; //atof(latAccuracy.value());
// gpsFixInfo.lonError = 1.5; //atof(lonAccuracy.value());
// gpsFixInfo.error = sqrt(gpsFixInfo.latError * gpsFixInfo.latError +
// gpsFixInfo.lonError * gpsFixInfo.lonError);
gpsFixInfo.error = (float)gps.hdop.value() * 5 / 100;
}
Expand Down Expand Up @@ -265,38 +262,33 @@ void gps_update() {
*/
}

float gps_getGlideRatio() { return glideRatio; }



float gps_getGlideRatio() {
return glideRatio;
}

// this is called whenever a new valid NMEA sentence contains a valid speed (TODO: check if true for every sentence or just every fix)
// this is called whenever a new valid NMEA sentence contains a valid speed (TODO: check if true for
// every sentence or just every fix)
void onNewSentence(NMEASentenceContents contents) {
windEstimate_onNewSentence(contents);

}

bool gps_read_buffer_once() {
if (gpsPort.available()) {
char a = gpsPort.read();
bool newSentence = gps.encode(a);
if (newSentence) {
NMEASentenceContents contents = {
.speed = gps.speed.isUpdated(),
.course = gps.course.isUpdated()
};
NMEASentenceContents contents = {.speed = gps.speed.isUpdated(),
.course = gps.course.isUpdated()};
onNewSentence(contents);
}

if (DEBUG_GPS) Serial.print(a);
return true;
} else {
return false;
}
}
}



// copy data from each satellite message into the sats[] array. Then, if we reach the complete set
// of sentences, copy the fresh sat data into the satDisplay[] array for showing on LCD screen when
// needed.
Expand Down Expand Up @@ -327,7 +319,8 @@ void gps_updateSatList() {
satsDisplay[i].snr = sats[i].snr;
satsDisplay[i].active = sats[i].active;

// keep track of how many satellites we can see while we're scanning through all the ID's (i)
// keep track of how many satellites we can see while we're scanning through all the ID's
// (i)
if (satsDisplay[i].active) satelliteCount++;

// then negate the source, so it will only be used if it's truly updated again (i.e.,
Expand Down Expand Up @@ -431,7 +424,7 @@ bool gps_getUtcDateTime(tm& cal) {

// like gps_getUtcDateTime, but has the timezone offset applied.
bool gps_getLocalDateTime(tm& cal) {
if(!gps_getUtcDateTime(cal)) {
if (!gps_getUtcDateTime(cal)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vario/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "logbook/flight.h"
#include "logbook/igc.h"
#include "logbook/kml.h"
#include "page_fanet_stats.h"
#include "settings.h"
#include "speaker.h"
#include "string_utils.h"
#include "tempRH.h"
#include "ui/page_fanet_stats.h"
#include "wind_estimate/wind_estimate.h"

// track if we're "flying" separate from if we're recording a log. This allows us to enable
Expand Down
6 changes: 4 additions & 2 deletions src/vario/logbook/flight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "FS.h"
#include "telemetry.h"
#include "page_flight_summary.h"
#include "ui/page_flight_summary.h"

void Flight::startFlight() {
File trackLogsDir = SD_MMC.open(this->desiredFilePath());
Expand Down Expand Up @@ -49,4 +49,6 @@ void Flight::end(const FlightStats stats) {
dialog.show(stats);
}

bool Flight::started() { return (boolean)file; }
bool Flight::started() {
return (boolean)file;
}
4 changes: 2 additions & 2 deletions src/vario/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include "baro.h"
#include "buttons.h"
#include "configuration.h"
#include "display.h"
#include "displayFields.h"
#include "gps.h"
#include "log.h"
#include "power.h"
#include "settings.h"
#include "speaker.h"
#include "tempRH.h"
#include "ui/display.h"
#include "ui/displayFields.h"

POWER power; // struct for battery-state and on-state variables

Expand Down
2 changes: 1 addition & 1 deletion src/vario/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <nvs_flash.h>

#include "baro.h"
#include "display.h"
#include "gps.h"
#include "speaker.h"
#include "ui/display.h"

#define RW_MODE false
#define RO_MODE true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "flight_stats.h"
#include "logbook/flight_stats.h"
#include "menu_page.h"

class PageFlightSummary : public SimpleSettingsMenuPage {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/vario/vario.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include "baro.h"
#include "ble.h"
#include "buttons.h"
#include "display.h"
#include "gps.h"
#include "log.h"
#include "power.h"
#include "settings.h"
#include "speaker.h"
#include "tempRH.h"
#include "ui/display.h"
#include "wind_estimate/wind_estimate.h"

#ifdef MEMORY_PROFILING
Expand Down

0 comments on commit 2d0fd8a

Please sign in to comment.