summaryrefslogtreecommitdiff
path: root/src/components/ble
diff options
context:
space:
mode:
authorTim Keller <geekboy1011@gmail.com>2021-10-26 03:42:34 +0000
committerTim Keller <geekboy1011@gmail.com>2021-12-10 01:18:57 +0000
commit8f46908d387cc4fe3f911bc0ca517719238418ed (patch)
treea187cd93568e5d4e85722923eba0176082b140c9 /src/components/ble
parentf4322841ffc011ea5c541e40e6aa73ab11ebd988 (diff)
Fix lvgl_open to respect littlefs open errors
Diffstat (limited to 'src/components/ble')
-rw-r--r--src/components/ble/FSService.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/components/ble/FSService.cpp b/src/components/ble/FSService.cpp
index c784a8c4..0230ea15 100644
--- a/src/components/ble/FSService.cpp
+++ b/src/components/ble/FSService.cpp
@@ -156,7 +156,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
resp.command = commands::WRITE_PACING;
resp.offset = header->offset;
resp.modTime = 0;
- int res = fs.FileOpen(&f, filepath, LFS_O_RDWR | LFS_O_CREAT);
+ int res = fs.FileOpen(&f, filepath, LFS_O_WRONLY | LFS_O_CREAT);
resp.status = res ? 0x02 : 0x01;
fs.FileClose(&f);
resp.freespace = std::min(fs.getSize() - (fs.GetFSSize() * fs.getBlockSize()), fileSize - header->offset);
@@ -177,7 +177,6 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
fs.FileWrite(&f, header->data, header->dataSize);
fs.FileClose(&f);
resp.freespace = std::min(fs.getSize() - (fs.GetFSSize() * fs.getBlockSize()), fileSize - header->offset);
- // NRF_LOG_INFO('[FS_S] Used Blocks -> %u',resp.freespace);
auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(WriteResponse));
ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
break;
@@ -222,14 +221,13 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
resp.status = 1;
resp.totalentries = 0;
resp.entry = 0;
- resp.modification_time = 0; // TODO Does LFS actually support TS?
+ resp.modification_time = 0;
if (fs.DirOpen(path, &dir) != 0) {
resp.status = 0x02;
auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(ListDirResponse));
ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
break;
};
- // Count Total files in directory.
while (fs.DirRead(&dir, &info)) {
resp.totalentries++;
}