merged with master

This commit is contained in:
grcasanova
2020-07-06 21:53:10 +02:00
26 changed files with 898 additions and 354 deletions

View File

@@ -29,14 +29,6 @@ class DebugInfo
DebugInfo(const DebugInfo &) = delete;
DebugInfo &operator=(const DebugInfo &) = delete;
/// Sets user statistics.
void setNodeNumbersStatus(int online, int total)
{
concurrency::LockGuard guard(&lock);
nodesOnline = online;
nodesTotal = total;
}
/// Sets the name of the channel.
void setChannelNameStatus(const char *name)
{
@@ -44,25 +36,6 @@ class DebugInfo
channelName = name;
}
/// Sets battery/charging/etc status.
//
void setPowerStatus(const PowerStatus &status)
{
concurrency::LockGuard guard(&lock);
powerStatus = status;
}
/// Sets GPS status.
//
// If this function never gets called, we assume GPS does not exist on this
// device.
// TODO(girts): figure out what the format should be.
void setGPSStatus(const char *status)
{
concurrency::LockGuard guard(&lock);
gpsStatus = status;
}
private:
friend Screen;
@@ -71,15 +44,8 @@ class DebugInfo
/// Renders the debug screen.
void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
int nodesOnline = 0;
int nodesTotal = 0;
PowerStatus powerStatus;
std::string channelName;
std::string gpsStatus;
/// Protects all of internal state.
concurrency::Lock lock;
};
@@ -93,6 +59,10 @@ class DebugInfo
// simultaneously).
class Screen : public concurrency::PeriodicTask
{
CallbackObserver<Screen, const Status *> powerStatusObserver = CallbackObserver<Screen, const Status *>(this, &Screen::handleStatusUpdate);
CallbackObserver<Screen, const Status *> gpsStatusObserver = CallbackObserver<Screen, const Status *>(this, &Screen::handleStatusUpdate);
CallbackObserver<Screen, const Status *> nodeStatusObserver = CallbackObserver<Screen, const Status *>(this, &Screen::handleStatusUpdate);
public:
Screen(uint8_t address, int sda = -1, int scl = -1);
@@ -119,7 +89,7 @@ class Screen : public concurrency::PeriodicTask
// Implementation to Adjust Brightness
void adjustBrightness();
int brightness = 150;
uint8_t brightness = 150;
/// Starts showing the Bluetooth PIN screen.
//
@@ -189,6 +159,8 @@ class Screen : public concurrency::PeriodicTask
// Use this handle to set things like battery status, user count, GPS status, etc.
DebugInfo* debug_info() { return &debugInfo; }
int handleStatusUpdate(const meshtastic::Status *arg);
protected:
/// Updates the UI.
//