mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-25 22:20:27 +00:00
Add raspbian reboot and shutdown behavior
This commit is contained in:
parent
ded1cbf4dd
commit
6c1db94ae7
@ -1,6 +1,6 @@
|
|||||||
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#ff5da1d203b5c1163cfcda858d5f84920187f030
|
platform = https://github.com/meshtastic/platform-native.git#8a66ef82cf38a4135d85cbb5043d0e8ebbb8ba17
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
@ -23,6 +23,11 @@ LinuxInput::LinuxInput(const char *name) : concurrency::OSThread(name)
|
|||||||
this->_originName = name;
|
this->_originName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinuxInput::deInit()
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t LinuxInput::runOnce()
|
int32_t LinuxInput::runOnce()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class LinuxInput : public Observable<const InputEvent *>, public concurrency::OS
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit LinuxInput(const char *name);
|
explicit LinuxInput(const char *name);
|
||||||
|
void deInit(); // Strictly for cleanly "rebooting" the binary on native
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce() override;
|
virtual int32_t runOnce() override;
|
||||||
|
@ -15,6 +15,10 @@ void initApiServer(int port)
|
|||||||
apiPort->init();
|
apiPort->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void deInitApiServer()
|
||||||
|
{
|
||||||
|
delete apiPort;
|
||||||
|
}
|
||||||
|
|
||||||
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : ServerAPI(_client)
|
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : ServerAPI(_client)
|
||||||
{
|
{
|
||||||
|
@ -23,3 +23,4 @@ class WiFiServerPort : public APIServerPort<WiFiServerAPI, WiFiServer>
|
|||||||
};
|
};
|
||||||
|
|
||||||
void initApiServer(int port = 4403);
|
void initApiServer(int port = 4403);
|
||||||
|
void deInitApiServer();
|
@ -1,6 +1,8 @@
|
|||||||
|
#include "api/WiFiServerAPI.h"
|
||||||
#include "buzz.h"
|
#include "buzz.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "graphics/Screen.h"
|
#include "graphics/Screen.h"
|
||||||
|
#include "input/LinuxInputImpl.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
|
||||||
@ -15,7 +17,13 @@ void powerCommandsCheck()
|
|||||||
#elif defined(ARCH_RP2040)
|
#elif defined(ARCH_RP2040)
|
||||||
rp2040.reboot();
|
rp2040.reboot();
|
||||||
#elif defined(ARCH_RASPBERRY_PI)
|
#elif defined(ARCH_RASPBERRY_PI)
|
||||||
exit(EXIT_SUCCESS);
|
deInitApiServer();
|
||||||
|
if (aLinuxInputImpl)
|
||||||
|
aLinuxInputImpl->deInit();
|
||||||
|
SPI.end();
|
||||||
|
Wire.end();
|
||||||
|
Serial1.end();
|
||||||
|
reboot();
|
||||||
#else
|
#else
|
||||||
rebootAtMsec = -1;
|
rebootAtMsec = -1;
|
||||||
LOG_WARN("FIXME implement reboot for this platform. Note that some settings require a restart to be applied.\n");
|
LOG_WARN("FIXME implement reboot for this platform. Note that some settings require a restart to be applied.\n");
|
||||||
@ -33,6 +41,8 @@ void powerCommandsCheck()
|
|||||||
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
|
#elif ARCH_RASPBERRY_PI
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
#else
|
#else
|
||||||
LOG_WARN("FIXME implement shutdown for this platform");
|
LOG_WARN("FIXME implement shutdown for this platform");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user