Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions boards/rpi_zero_2w.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"build": {
"arduino": {
},
"core": "linux",
"extra_flags": [
],
"hwids": [],
"mcu": "arm64",
"variant": "raspberry-pi-zero-2-w"
},
"connectivity": ["wifi", "bluetooth"],
"debug": {},
"frameworks": ["portduino", "linux"],
"name": "Raspberry Pi Zero 2 W",
"upload": {
"maximum_ram_size": 0,
"maximum_size": 0
},
"url": "https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-zero-2-w",
"vendor": "RaspberryPi"
}
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ build_firmware() {
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null || true

if [ -f .pio/build/$1/program ]; then
cp .pio/build/$1/program out/meshcored 2>/dev/null || true
fi

}

# firmwares containing $1 will be built
Expand Down
20 changes: 12 additions & 8 deletions examples/companion_radio/DataStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DataStore::DataStore(FILESYSTEM& fs, mesh::RTCClock& clock) : _fs(&fs), _fsExtra(nullptr), _clock(&clock),
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
identity_store(fs, "")
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
identity_store(fs, "/identity")
#else
identity_store(fs, "/identity")
Expand All @@ -22,7 +22,7 @@ DataStore::DataStore(FILESYSTEM& fs, mesh::RTCClock& clock) : _fs(&fs), _fsExtra
DataStore::DataStore(FILESYSTEM& fs, FILESYSTEM& fsExtra, mesh::RTCClock& clock) : _fs(&fs), _fsExtra(&fsExtra), _clock(&clock),
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
identity_store(fs, "")
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
identity_store(fs, "/identity")
#else
identity_store(fs, "/identity")
Expand All @@ -35,7 +35,7 @@ static File openWrite(FILESYSTEM* fs, const char* filename) {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
fs->remove(filename);
return fs->open(filename, FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
return fs->open(filename, "w");
#else
return fs->open(filename, "w", true);
Expand All @@ -47,7 +47,7 @@ static File openWrite(FILESYSTEM* fs, const char* filename) {
#endif

void DataStore::begin() {
#if defined(RP2040_PLATFORM)
#if defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
identity_store.begin();
#endif

Expand All @@ -67,6 +67,8 @@ void DataStore::begin() {
#include <SPIFFS.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
#elif defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
#if defined(QSPIFLASH)
#include <CustomLFS_QSPIFlash.h>
Expand Down Expand Up @@ -102,7 +104,7 @@ lfs_ssize_t _getLfsUsedBlockCount(FILESYSTEM* fs) {
uint32_t DataStore::getStorageUsedKb() const {
#if defined(ESP32)
return SPIFFS.usedBytes() / 1024;
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
FSInfo info;
info.usedBytes = 0;
_fs->info(info);
Expand All @@ -120,7 +122,7 @@ uint32_t DataStore::getStorageUsedKb() const {
uint32_t DataStore::getStorageTotalKb() const {
#if defined(ESP32)
return SPIFFS.totalBytes() / 1024;
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
FSInfo info;
info.totalBytes = 0;
_fs->info(info);
Expand All @@ -137,7 +139,7 @@ uint32_t DataStore::getStorageTotalKb() const {
File DataStore::openRead(const char* filename) {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return _fs->open(filename, FILE_O_READ);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
return _fs->open(filename, "r");
#else
return _fs->open(filename, "r", false);
Expand All @@ -147,7 +149,7 @@ File DataStore::openRead(const char* filename) {
File DataStore::openRead(FILESYSTEM* fs, const char* filename) {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return fs->open(filename, FILE_O_READ);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
return fs->open(filename, "r");
#else
return fs->open(filename, "r", false);
Expand All @@ -171,6 +173,8 @@ bool DataStore::formatFileSystem() {
}
#elif defined(RP2040_PLATFORM)
return LittleFS.format();
#elif defined(ARCH_PORTDUINO)
return true;
#elif defined(ESP32)
return ((fs::SPIFFSFS *)_fs)->format();
#else
Expand Down
2 changes: 2 additions & 0 deletions examples/companion_radio/MyMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
Expand Down
12 changes: 12 additions & 0 deletions examples/companion_radio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ static uint32_t _atoi(const char* sp) {
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
DataStore store(LittleFS, rtc_clock);
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
DataStore store(PortduinoFS, rtc_clock);
#elif defined(ESP32)
#include <SPIFFS.h>
DataStore store(SPIFFS, rtc_clock);
Expand Down Expand Up @@ -184,6 +187,15 @@ void setup() {
serial_interface.begin(Serial);
#endif
the_mesh.startInterface(serial_interface);
#elif defined(ARCH_PORTDUINO)
store.begin();
the_mesh.begin(
#ifdef DISPLAY_CLASS
disp != NULL
#else
false
#endif
);
#elif defined(ESP32)
SPIFFS.begin(true);
store.begin();
Expand Down
12 changes: 9 additions & 3 deletions examples/simple_repeater/MyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ mesh::Packet *MyMesh::createSelfAdvert() {
File MyMesh::openAppend(const char *fname) {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return _fs->open(fname, FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
return _fs->open(fname, "a");
#else
return _fs->open(fname, "a", true);
Expand Down Expand Up @@ -687,11 +687,13 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
_prefs.node_lat = ADVERT_LAT;
_prefs.node_lon = ADVERT_LON;
StrHelper::strncpy(_prefs.password, ADMIN_PASSWORD, sizeof(_prefs.password));
#ifndef SKIP_CONFIG_OVERWRITE
_prefs.freq = LORA_FREQ;
_prefs.sf = LORA_SF;
_prefs.bw = LORA_BW;
_prefs.cr = LORA_CR;
_prefs.tx_power_dbm = LORA_TX_POWER;
#endif
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
_prefs.flood_advert_interval = 12; // 12 hours
_prefs.flood_max = 64;
Expand Down Expand Up @@ -753,6 +755,10 @@ bool MyMesh::formatFileSystem() {
return InternalFS.format();
#elif defined(RP2040_PLATFORM)
return LittleFS.format();
#elif defined(ARCH_PORTDUINO)
return true;
#elif defined(ARCH_PORTDUINO)
return true;
#elif defined(ESP32)
return SPIFFS.format();
#else
Expand Down Expand Up @@ -787,7 +793,7 @@ void MyMesh::updateFloodAdvertTimer() {
}

void MyMesh::dumpLogFile() {
#if defined(RP2040_PLATFORM)
#if defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
File f = _fs->open(PACKET_LOG_FILE, "r");
#else
File f = _fs->open(PACKET_LOG_FILE);
Expand Down Expand Up @@ -880,7 +886,7 @@ void MyMesh::saveIdentity(const mesh::LocalIdentity &new_id) {
IdentityStore store(*_fs, "");
#elif defined(ESP32)
IdentityStore store(*_fs, "/identity");
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
IdentityStore store(*_fs, "/identity");
#else
#error "need to define saveIdentity()"
Expand Down
2 changes: 2 additions & 0 deletions examples/simple_repeater/MyMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
Expand Down
4 changes: 4 additions & 0 deletions examples/simple_repeater/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ void setup() {
fs = &LittleFS;
IdentityStore store(LittleFS, "/identity");
store.begin();
#elif defined(ARCH_PORTDUINO)
fs = &PortduinoFS;
IdentityStore store(PortduinoFS, "/identity");
store.begin();
#else
#error "need to define filesystem"
#endif
Expand Down
8 changes: 5 additions & 3 deletions examples/simple_room_server/MyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mesh::Packet *MyMesh::createSelfAdvert() {
File MyMesh::openAppend(const char *fname) {
#if defined(NRF52_PLATFORM)
return _fs->open(fname, FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
return _fs->open(fname, "a");
#else
return _fs->open(fname, "a", true);
Expand Down Expand Up @@ -661,6 +661,8 @@ bool MyMesh::formatFileSystem() {
return InternalFS.format();
#elif defined(RP2040_PLATFORM)
return LittleFS.format();
#elif defined(ARCH_PORTDUINO)
return true;
#elif defined(ESP32)
return SPIFFS.format();
#else
Expand Down Expand Up @@ -694,7 +696,7 @@ void MyMesh::updateFloodAdvertTimer() {
}

void MyMesh::dumpLogFile() {
#if defined(RP2040_PLATFORM)
#if defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
File f = _fs->open(PACKET_LOG_FILE, "r");
#else
File f = _fs->open(PACKET_LOG_FILE);
Expand All @@ -719,7 +721,7 @@ void MyMesh::saveIdentity(const mesh::LocalIdentity &new_id) {
IdentityStore store(*_fs, "");
#elif defined(ESP32)
IdentityStore store(*_fs, "/identity");
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
IdentityStore store(*_fs, "/identity");
#else
#error "need to define saveIdentity()"
Expand Down
2 changes: 2 additions & 0 deletions examples/simple_room_server/MyMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
Expand Down
4 changes: 4 additions & 0 deletions examples/simple_room_server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ void setup() {
fs = &LittleFS;
IdentityStore store(LittleFS, "/identity");
store.begin();
#elif defined(ARCH_PORTDUINO)
fs = &PortduinoFS;
IdentityStore store(PortduinoFS, "/identity");
store.begin();
#elif defined(ESP32)
SPIFFS.begin(true);
fs = &SPIFFS;
Expand Down
14 changes: 9 additions & 5 deletions examples/simple_secure_chat/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
Expand Down Expand Up @@ -90,7 +92,7 @@ class MyMesh : public BaseChatMesh, ContactVisitor {

void loadContacts() {
if (_fs->exists("/contacts")) {
#if defined(RP2040_PLATFORM)
#if defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
File file = _fs->open("/contacts", "r");
#else
File file = _fs->open("/contacts");
Expand Down Expand Up @@ -129,7 +131,7 @@ class MyMesh : public BaseChatMesh, ContactVisitor {
#if defined(NRF52_PLATFORM)
_fs->remove("/contacts");
File file = _fs->open("/contacts", FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
File file = _fs->open("/contacts", "w");
#else
File file = _fs->open("/contacts", "w", true);
Expand Down Expand Up @@ -299,7 +301,7 @@ class MyMesh : public BaseChatMesh, ContactVisitor {

#if defined(NRF52_PLATFORM)
IdentityStore store(fs, "");
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
IdentityStore store(fs, "/identity");
store.begin();
#else
Expand All @@ -324,7 +326,7 @@ class MyMesh : public BaseChatMesh, ContactVisitor {

// load persisted prefs
if (_fs->exists("/node_prefs")) {
#if defined(RP2040_PLATFORM)
#if defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
File file = _fs->open("/node_prefs", "r");
#else
File file = _fs->open("/node_prefs");
Expand All @@ -343,7 +345,7 @@ class MyMesh : public BaseChatMesh, ContactVisitor {
#if defined(NRF52_PLATFORM)
_fs->remove("/node_prefs");
File file = _fs->open("/node_prefs", FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
File file = _fs->open("/node_prefs", "w");
#else
File file = _fs->open("/node_prefs", "w", true);
Expand Down Expand Up @@ -569,6 +571,8 @@ void setup() {
#elif defined(RP2040_PLATFORM)
LittleFS.begin();
the_mesh.begin(LittleFS);
#elif defined(ARCH_PORTDUINO)
the_mesh.begin(PortduinoFS);
#elif defined(ESP32)
SPIFFS.begin(true);
the_mesh.begin(SPIFFS);
Expand Down
6 changes: 4 additions & 2 deletions examples/simple_sensor/SensorMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
static File openAppend(FILESYSTEM* _fs, const char* fname) {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return _fs->open(fname, FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
return _fs->open(fname, "a");
#else
return _fs->open(fname, "a", true);
Expand Down Expand Up @@ -750,6 +750,8 @@ bool SensorMesh::formatFileSystem() {
return InternalFS.format();
#elif defined(RP2040_PLATFORM)
return LittleFS.format();
#elif defined(ARCH_PORTDUINO)
return true;
#elif defined(ESP32)
return SPIFFS.format();
#else
Expand All @@ -764,7 +766,7 @@ void SensorMesh::saveIdentity(const mesh::LocalIdentity& new_id) {
IdentityStore store(*_fs, "");
#elif defined(ESP32)
IdentityStore store(*_fs, "/identity");
#elif defined(RP2040_PLATFORM)
#elif defined(RP2040_PLATFORM) || defined(ARCH_PORTDUINO)
IdentityStore store(*_fs, "/identity");
#else
#error "need to define saveIdentity()"
Expand Down
2 changes: 2 additions & 0 deletions examples/simple_sensor/SensorMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ARCH_PORTDUINO)
#include <PortduinoFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
Expand Down
4 changes: 4 additions & 0 deletions examples/simple_sensor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ void setup() {
fs = &LittleFS;
IdentityStore store(LittleFS, "/identity");
store.begin();
#elif defined(ARCH_PORTDUINO)
fs = &PortduinoFS;
IdentityStore store(PortduinoFS, "/identity");
store.begin();
#else
#error "need to define filesystem"
#endif
Expand Down
Loading