mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 11:23:53 +00:00
clean up filesystem goo, add spiffs to install scripts, fix #496
@mc-hamster seems to work pretty good for me, so I'll send a PR to you for the dev-http branch. I'll push out an android alpha build later today (once the build is complete). Once this new device load is out in the field _future_ device builds will support updating spiffs from android. (i.e. device loads older than 1.1.9 must be updated to 1.1.9 or later before spiffs support is implemented on the device side - so some users might need to update twice before the new spiffs contents will appear on their device)
This commit is contained in:
parent
df75cefeeb
commit
d7d13d637c
@ -9,7 +9,7 @@ COUNTRIES="US EU433 EU865 CN JP ANZ KR"
|
|||||||
#COUNTRIES=CN
|
#COUNTRIES=CN
|
||||||
|
|
||||||
BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
|
BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
|
||||||
# BOARDS_ESP32=tbeam
|
#BOARDS_ESP32=tbeam
|
||||||
|
|
||||||
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
||||||
BOARDS_NRF52="lora-relay-v1"
|
BOARDS_NRF52="lora-relay-v1"
|
||||||
@ -113,6 +113,6 @@ XML
|
|||||||
|
|
||||||
echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
|
echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
|
||||||
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
||||||
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
|
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
|
||||||
|
|
||||||
echo BUILT ALL
|
echo BUILT ALL
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# Usage info
|
# Usage info
|
||||||
show_help() {
|
show_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ -36,6 +38,7 @@ if [ -f "${FILENAME}" ]; then
|
|||||||
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
|
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
|
||||||
esptool.py --baud 921600 erase_flash
|
esptool.py --baud 921600 erase_flash
|
||||||
esptool.py --baud 921600 write_flash 0x1000 system-info.bin
|
esptool.py --baud 921600 write_flash 0x1000 system-info.bin
|
||||||
|
esptool.py --baud 921600 write_flash 0x00390000 spiffs-*.bin
|
||||||
esptool.py --baud 921600 write_flash 0x10000 ${FILENAME}
|
esptool.py --baud 921600 write_flash 0x10000 ${FILENAME}
|
||||||
else
|
else
|
||||||
echo "Invalid file: ${FILENAME}"
|
echo "Invalid file: ${FILENAME}"
|
||||||
|
21
src/FSCommon.cpp
Normal file
21
src/FSCommon.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "FSCommon.h"
|
||||||
|
|
||||||
|
void fsInit()
|
||||||
|
{
|
||||||
|
#ifdef FS
|
||||||
|
if (!FSBegin())
|
||||||
|
{
|
||||||
|
DEBUG_MSG("ERROR filesystem mount Failed\n");
|
||||||
|
assert(0); // FIXME - report failure to phone
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_MSG("Filesystem files:\n");
|
||||||
|
File dir = FS.open("/");
|
||||||
|
File f = dir.openNextFile();
|
||||||
|
while (f) {
|
||||||
|
DEBUG_MSG(" %s\n", f.name());
|
||||||
|
f.close();
|
||||||
|
f = dir.openNextFile();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
29
src/FSCommon.h
Normal file
29
src/FSCommon.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
// Cross platform filesystem API
|
||||||
|
|
||||||
|
#ifdef PORTDUINO
|
||||||
|
// Portduino version
|
||||||
|
#include "PortduinoFS.h"
|
||||||
|
#define FS PortduinoFS
|
||||||
|
#define FSBegin() true
|
||||||
|
#define FILE_O_WRITE "w"
|
||||||
|
#define FILE_O_READ "r"
|
||||||
|
#elif !defined(NO_ESP32)
|
||||||
|
// ESP32 version
|
||||||
|
#include "SPIFFS.h"
|
||||||
|
#define FS SPIFFS
|
||||||
|
#define FSBegin() FS.begin(true)
|
||||||
|
#define FILE_O_WRITE "w"
|
||||||
|
#define FILE_O_READ "r"
|
||||||
|
#else
|
||||||
|
// NRF52 version
|
||||||
|
#include "InternalFileSystem.h"
|
||||||
|
#define FS InternalFS
|
||||||
|
#define FSBegin() FS.begin()
|
||||||
|
using namespace Adafruit_LittleFS_Namespace;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void fsInit();
|
@ -11,6 +11,7 @@
|
|||||||
// #include "rom/rtc.h"
|
// #include "rom/rtc.h"
|
||||||
#include "DSRRouter.h"
|
#include "DSRRouter.h"
|
||||||
// #include "debug.h"
|
// #include "debug.h"
|
||||||
|
#include "FSCommon.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
@ -209,7 +210,7 @@ class ButtonThread : public OSThread
|
|||||||
canSleep &= userButtonAlt.isIdle();
|
canSleep &= userButtonAlt.isIdle();
|
||||||
#endif
|
#endif
|
||||||
// if (!canSleep) DEBUG_MSG("Supressing sleep!\n");
|
// if (!canSleep) DEBUG_MSG("Supressing sleep!\n");
|
||||||
//else DEBUG_MSG("sleep ok\n");
|
// else DEBUG_MSG("sleep ok\n");
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
@ -227,11 +228,11 @@ class ButtonThread : public OSThread
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void userButtonDoublePressed()
|
static void userButtonDoublePressed()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
disablePin();
|
disablePin();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static Periodic *ledPeriodic;
|
static Periodic *ledPeriodic;
|
||||||
@ -266,6 +267,8 @@ void setup()
|
|||||||
|
|
||||||
ledPeriodic = new Periodic("Blink", ledBlinker);
|
ledPeriodic = new Periodic("Blink", ledBlinker);
|
||||||
|
|
||||||
|
fsInit();
|
||||||
|
|
||||||
router = new DSRRouter();
|
router = new DSRRouter();
|
||||||
|
|
||||||
#ifdef I2C_SDA
|
#ifdef I2C_SDA
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "meshwifi/meshwifi.h"
|
#include "meshwifi/meshwifi.h"
|
||||||
|
#include "FSCommon.h"
|
||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
@ -35,27 +36,7 @@ DeviceState versions used to be defined in the .proto file but really only this
|
|||||||
#define DEVICESTATE_CUR_VER 11
|
#define DEVICESTATE_CUR_VER 11
|
||||||
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
|
||||||
// Portduino version
|
|
||||||
#include "PortduinoFS.h"
|
|
||||||
#define FS PortduinoFS
|
|
||||||
#define FSBegin() true
|
|
||||||
#define FILE_O_WRITE "w"
|
|
||||||
#define FILE_O_READ "r"
|
|
||||||
#elif !defined(NO_ESP32)
|
|
||||||
// ESP32 version
|
|
||||||
#include "SPIFFS.h"
|
|
||||||
#define FS SPIFFS
|
|
||||||
#define FSBegin() FS.begin(true)
|
|
||||||
#define FILE_O_WRITE "w"
|
|
||||||
#define FILE_O_READ "r"
|
|
||||||
#else
|
|
||||||
// NRF52 version
|
|
||||||
#include "InternalFileSystem.h"
|
|
||||||
#define FS InternalFS
|
|
||||||
#define FSBegin() FS.begin()
|
|
||||||
using namespace Adafruit_LittleFS_Namespace;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FIXME - move this somewhere else
|
// FIXME - move this somewhere else
|
||||||
extern void getMacAddr(uint8_t *dmac);
|
extern void getMacAddr(uint8_t *dmac);
|
||||||
@ -210,12 +191,6 @@ void NodeDB::init()
|
|||||||
{
|
{
|
||||||
installDefaultDeviceState();
|
installDefaultDeviceState();
|
||||||
|
|
||||||
if (!FSBegin()) // FIXME - do this in main?
|
|
||||||
{
|
|
||||||
DEBUG_MSG("ERROR filesystem mount Failed\n");
|
|
||||||
assert(0); // FIXME - report failure to phone
|
|
||||||
}
|
|
||||||
|
|
||||||
// saveToDisk();
|
// saveToDisk();
|
||||||
loadFromDisk();
|
loadFromDisk();
|
||||||
// saveToDisk();
|
// saveToDisk();
|
||||||
|
Loading…
Reference in New Issue
Block a user