Skip to content

Commit

Permalink
commit merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
paxo-rch committed Sep 4, 2024
1 parent a65183c commit 1720e6c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/graphics/src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ int getTouch(uint16_t *pPoints)

void graphics::touchUpdate()
{
if(StandbyMode::state() == true)
return;
bool touchState = true;
int16_t liveTouchX = 0, liveTouchY = 0;

Expand Down
34 changes: 32 additions & 2 deletions lib/gsm/src/gsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <delay.hpp>
#include <threads.hpp>
#include <graphics.hpp>
#include <standby.hpp>

#include "Image.hpp"
#include "Surface.hpp"
Expand Down Expand Up @@ -41,6 +42,7 @@ namespace GSM
uint16_t seconds, minutes, hours, days, months, years = 0;
float voltage = -1;
int networkQuality = 0;
bool flightMode = false;

namespace ExternalEvents
{
Expand Down Expand Up @@ -988,12 +990,14 @@ namespace GSM

try
{
return std::stof(voltage_str);
voltage = std::stof(voltage_str);
}
catch (std::exception)
{
return 0;
voltage = -1;
}

return 0;
}

double getBatteryLevel() {
Expand Down Expand Up @@ -1128,6 +1132,32 @@ namespace GSM
requests.push_back({&GSM::updateNetworkQuality, priority::normal});
}

void updateFlightMode()
{
if(flightMode)
{
std::cout << "Flight Mode ON" << std::endl;
std::cout << send("AT+CFUN=4", "AT+CFUN", 1000) << std::endl;
}
else
{
std::cout << "Flight Mode OFF" << std::endl;
//std::cout << send("AT+CFUN=6", "AT+CFUN", 1000) << std::endl;
std::cout << send("AT+CFUN=1", "AT+CFUN", 1000) << std::endl;
}
}

bool isFlightMode()
{
return flightMode;
}

void setFlightMode(bool mode)
{
eventHandlerBack.setTimeout(new Callback<>([mode](){ appendRequest({updateFlightMode}); }), 0);
flightMode = mode;
}

void run()
{
init();
Expand Down
3 changes: 3 additions & 0 deletions lib/gsm/src/gsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ namespace GSM

int getNetworkStatus();

bool isFlightMode();
void setFlightMode(bool mode);

std::string getCurrentTimestamp();
std::string getCurrentTimestampNoSpaces();
void clearFrom(const std::string &from, const std::string &to);
Expand Down
6 changes: 6 additions & 0 deletions lib/gui/src/ElementBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ void gui::ElementBase::renderAll(bool onScreen)

bool gui::ElementBase::updateAll()
{
if(!m_isEnabled)
return false;

if(!isInside())
{
if(m_surface != nullptr)
Expand Down Expand Up @@ -189,6 +192,9 @@ bool gui::ElementBase::update()
{
// algorithme de mise a jour des interactions tactiles

if(!this->m_isEnabled)
return false;

widgetUpdate();

if (!m_hasEvents && widgetPressed != this)
Expand Down
6 changes: 6 additions & 0 deletions lib/tasks/src/standby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ namespace StandbyMode
graphics::setBrightness(0);
StandbyMode::savePower();

while(AppManager::isAnyVisibleApp())
{
AppManager::appStack[AppManager::appStack.size() - 1]->kill();
AppManager::appStack.pop_back();
}

while (hardware::getHomeButton());
while (!hardware::getHomeButton() && !AppManager::isAnyVisibleApp() && millis() - sleepTime > lastTrigger)
{
Expand Down

0 comments on commit 1720e6c

Please sign in to comment.