From 3f43c512a7c16307ba8a9eeacd54babaaedac451 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Mon, 25 Sep 2023 17:54:15 +0200 Subject: [PATCH] fix fs read --- fs_helper.h | 6 ++---- juRCReceiver.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs_helper.h b/fs_helper.h index e38a8f2..0cd9424 100644 --- a/fs_helper.h +++ b/fs_helper.h @@ -16,13 +16,11 @@ void init_little_fs() { } bool fs_read(String path, void *buffer, size_t len) { - char centerData[len]; mutex_enter_blocking(&littelfs_mut); File f = LittleFS.open(path, "r"); bool succ = false; if (f) { - if (f.readBytes((char *)centerData, len) == len) { - memmove(&buffer, ¢erData, len); + if (f.readBytes((char *)buffer, len) == len) { succ = true; } 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) { mutex_enter_blocking(&littelfs_mut); - File f = LittleFS.open(path, "w+"); + File f = LittleFS.open(path, "w"); bool succ = false; if (f) { if (f.write((const unsigned char *)buffer, len) == len) { diff --git a/juRCReceiver.h b/juRCReceiver.h index db4fafd..b54596e 100644 --- a/juRCReceiver.h +++ b/juRCReceiver.h @@ -91,7 +91,7 @@ void jSensorLoop() { avg = avg * 0.9 + delta * 0.1; #if debug if ((dcounterxy) % 100 == 0) - Serial.println("Sensor Loop, avg = " + String(avg)); + Serial.println("Sensor Loop, avg = " + String(avg/1000)); #endif MPULoop(); GNSSLoop();