fix fs read

This commit is contained in:
jusax23 2023-09-25 17:54:15 +02:00
parent 1e4a2250d9
commit 3f43c512a7
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
2 changed files with 3 additions and 5 deletions

View file

@ -16,13 +16,11 @@ void init_little_fs() {
} }
bool fs_read(String path, void *buffer, size_t len) { bool fs_read(String path, void *buffer, size_t len) {
char centerData[len];
mutex_enter_blocking(&littelfs_mut); mutex_enter_blocking(&littelfs_mut);
File f = LittleFS.open(path, "r"); File f = LittleFS.open(path, "r");
bool succ = false; bool succ = false;
if (f) { if (f) {
if (f.readBytes((char *)centerData, len) == len) { if (f.readBytes((char *)buffer, len) == len) {
memmove(&buffer, &centerData, len);
succ = true; succ = true;
} }
f.close(); f.close();
@ -33,7 +31,7 @@ bool fs_read(String path, void *buffer, size_t len) {
bool fs_write(String path, void *buffer, size_t len) { bool fs_write(String path, void *buffer, size_t len) {
mutex_enter_blocking(&littelfs_mut); mutex_enter_blocking(&littelfs_mut);
File f = LittleFS.open(path, "w+"); File f = LittleFS.open(path, "w");
bool succ = false; bool succ = false;
if (f) { if (f) {
if (f.write((const unsigned char *)buffer, len) == len) { if (f.write((const unsigned char *)buffer, len) == len) {

View file

@ -91,7 +91,7 @@ void jSensorLoop() {
avg = avg * 0.9 + delta * 0.1; avg = avg * 0.9 + delta * 0.1;
#if debug #if debug
if ((dcounterxy) % 100 == 0) if ((dcounterxy) % 100 == 0)
Serial.println("Sensor Loop, avg = " + String(avg)); Serial.println("Sensor Loop, avg = " + String(avg/1000));
#endif #endif
MPULoop(); MPULoop();
GNSSLoop(); GNSSLoop();