trunk fmt

This commit is contained in:
Thomas Göttgens 2024-03-08 13:22:06 +01:00
parent a9fc31c026
commit a7c0109349
5 changed files with 34 additions and 32 deletions

View File

@ -34,30 +34,30 @@ SPIClass SPI1(HSPI);
bool copyFile(const char *from, const char *to) bool copyFile(const char *from, const char *to)
{ {
#if defined(ARCH_STM32WL) || defined(ARCH_APOLLO3) #if defined(ARCH_STM32WL) || defined(ARCH_APOLLO3)
unsigned char cbuffer[2048]; unsigned char cbuffer[2048];
// Var to hold the result of actions // Var to hold the result of actions
OSFS::result r; OSFS::result r;
r = OSFS::getFile(from, cbuffer); r = OSFS::getFile(from, cbuffer);
if (r == notfound) {
LOG_ERROR("Failed to open source file %s\n", from);
return false;
} else if (r == noerr) {
r = OSFS::newFile(to, cbuffer, true);
if (r == noerr) {
return true;
} else {
LOG_ERROR("OSFS Error %d\n", r);
return false;
}
if (r == notfound) {
LOG_ERROR("Failed to open source file %s\n", from);
return false;
} else if (r == noerr) {
r = OSFS::newFile(to, cbuffer, true);
if (r == noerr) {
return true;
} else { } else {
LOG_ERROR("OSFS Error %d\n", r); LOG_ERROR("OSFS Error %d\n", r);
return false; return false;
} }
return true;
} else {
LOG_ERROR("OSFS Error %d\n", r);
return false;
}
return true;
#elif defined(FSCom) #elif defined(FSCom)
unsigned char cbuffer[16]; unsigned char cbuffer[16];

View File

@ -33,19 +33,21 @@ const OSFS::result noerr = OSFS::result::NO_ERROR;
const OSFS::result notfound = OSFS::result::FILE_NOT_FOUND; const OSFS::result notfound = OSFS::result::FILE_NOT_FOUND;
// 3) How do I read from the medium? // 3) How do I read from the medium?
void OSFS::readNBytes(uint16_t address, unsigned int num, byte* output) { void OSFS::readNBytes(uint16_t address, unsigned int num, byte *output)
for (uint16_t i = address; i < address + num; i++) { {
*output = EEPROM.read(i); for (uint16_t i = address; i < address + num; i++) {
output++; *output = EEPROM.read(i);
} output++;
}
} }
// 4) How to I write to the medium? // 4) How to I write to the medium?
void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte* input) { void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input)
for (uint16_t i = address; i < address + num; i++) { {
EEPROM.update(i, *input); for (uint16_t i = address; i < address + num; i++) {
input++; EEPROM.update(i, *input);
} input++;
}
} }
#endif #endif

View File

@ -3,8 +3,8 @@
#include "CryptoEngine.h" #include "CryptoEngine.h"
#include "MeshRadio.h" #include "MeshRadio.h"
#include "NodeDB.h" #include "NodeDB.h"
#include "gps/RTC.h"
#include "configuration.h" #include "configuration.h"
#include "gps/RTC.h"
#include "main.h" #include "main.h"
#include "mesh-pb-constants.h" #include "mesh-pb-constants.h"
#include "modules/RoutingModule.h" #include "modules/RoutingModule.h"

View File

@ -2,12 +2,12 @@
#include "GPS.h" #include "GPS.h"
#include "MeshService.h" #include "MeshService.h"
#include "NodeDB.h" #include "NodeDB.h"
#include "gps/RTC.h"
#include "Router.h" #include "Router.h"
#include "TypeConversions.h" #include "TypeConversions.h"
#include "airtime.h" #include "airtime.h"
#include "configuration.h" #include "configuration.h"
#include "gps/GeoCoord.h" #include "gps/GeoCoord.h"
#include "gps/RTC.h"
#include "main.h" #include "main.h"
#include "meshtastic/atak.pb.h" #include "meshtastic/atak.pb.h"
#include "sleep.h" #include "sleep.h"