summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-03-26 01:19:51 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-03-26 01:37:03 (GMT)
commit9acd3ff0f8d12d2e97095ac562cbff3c7e8647ac (patch)
tree9d0e69a9ce4a38733cf1bdc5a150ecef5d73e8e2
parent268ddbdc7622ab2a6b0490701064ffdde13fee51 (diff)
sans fs; sans settings persist
-rw-r--r--src/CMakeLists.txt32
-rw-r--r--src/components/ble/FSService.cpp330
-rw-r--r--src/components/ble/FSService.h191
-rw-r--r--src/components/ble/NimbleController.cpp7
-rw-r--r--src/components/ble/NimbleController.h7
-rw-r--r--src/components/fs/FS.cpp198
-rw-r--r--src/components/fs/FS.h82
-rw-r--r--src/components/settings/Settings.cpp41
-rw-r--r--src/components/settings/Settings.h7
-rw-r--r--src/main.cpp5
-rw-r--r--src/systemtask/SystemTask.cpp20
-rw-r--r--src/systemtask/SystemTask.h3
12 files changed, 12 insertions, 911 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 290668a..3d8798b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -170,13 +170,6 @@ set(NIMBLE_SRC
libs/mynewt-nimble/nimble/host/util/src/addr.c
)
-set(LITTLEFS_SRC
- libs/littlefs/lfs_util.h
- libs/littlefs/lfs.h
- libs/littlefs/lfs_util.c
- libs/littlefs/lfs.c
- )
-
set(LVGL_SRC
libs/lv_conf.h
libs/lvgl/lvgl.h
@@ -454,7 +447,6 @@ list(APPEND SOURCE_FILES
components/ble/CurrentTimeService.cpp
components/ble/AlertNotificationService.cpp
components/ble/BatteryInformationService.cpp
- components/ble/FSService.cpp
components/ble/ImmediateAlertService.cpp
components/ble/ServiceDiscovery.cpp
components/ble/HeartRateService.cpp
@@ -463,7 +455,6 @@ list(APPEND SOURCE_FILES
components/motor/MotorController.cpp
components/settings/Settings.cpp
components/alarm/AlarmController.cpp
- components/fs/FS.cpp
drivers/Cst816s.cpp
FreeRTOS/port.c
FreeRTOS/port_cmsis_systick.c
@@ -522,7 +513,6 @@ list(APPEND RECOVERY_SOURCE_FILES
components/ble/CurrentTimeService.cpp
components/ble/AlertNotificationService.cpp
components/ble/BatteryInformationService.cpp
- components/ble/FSService.cpp
components/ble/ImmediateAlertService.cpp
components/ble/ServiceDiscovery.cpp
components/ble/HeartRateService.cpp
@@ -546,7 +536,6 @@ list(APPEND RECOVERY_SOURCE_FILES
components/heartrate/Biquad.cpp
components/heartrate/Ptagc.cpp
components/motor/MotorController.cpp
- components/fs/FS.cpp
buttonhandler/ButtonHandler.cpp
touchhandler/TouchHandler.cpp
)
@@ -628,7 +617,6 @@ set(INCLUDE_FILES
components/ble/DfuService.h
components/firmwarevalidator/FirmwareValidator.h
components/ble/BatteryInformationService.h
- components/ble/FSService.h
components/ble/ImmediateAlertService.h
components/ble/ServiceDiscovery.h
components/ble/BleClient.h
@@ -812,25 +800,13 @@ target_compile_options(lvgl PRIVATE
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
)
-# LITTLEFS_SRC
-add_library(littlefs STATIC ${LITTLEFS_SRC})
-target_include_directories(littlefs SYSTEM PUBLIC . ../)
-target_include_directories(littlefs SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
-target_compile_options(littlefs PRIVATE
- $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Wno-unused-function -Og -g3>
- $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Wno-unused-function -Os>
- $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Wno-unused-function -Og -g3 -fno-rtti>
- $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Wno-unused-function -Os -fno-rtti>
- $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
- )
-
# Build autonomous binary (without support for bootloader)
set(EXECUTABLE_NAME "pinetime-app")
set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld")
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME})
-target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs)
+target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl)
target_compile_options(${EXECUTABLE_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Wextra -Wformat -Wno-missing-field-initializers -Wno-unused-parameter -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Wextra -Wformat -Wno-missing-field-initializers -Wno-unused-parameter -Os>
@@ -859,7 +835,7 @@ set(IMAGE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERSION_
set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld")
add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
-target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs)
+target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl)
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME})
target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
@@ -895,7 +871,7 @@ endif()
set(EXECUTABLE_RECOVERY_NAME "pinetime-recovery")
set(EXECUTABLE_RECOVERY_FILE_NAME ${EXECUTABLE_RECOVERY_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
add_executable(${EXECUTABLE_RECOVERY_NAME} ${RECOVERY_SOURCE_FILES})
-target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs)
+target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk)
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME})
target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY")
target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC
@@ -925,7 +901,7 @@ set(EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-${
set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.bin)
set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES})
-target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs)
+target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk)
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME})
target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY")
target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC
diff --git a/src/components/ble/FSService.cpp b/src/components/ble/FSService.cpp
deleted file mode 100644
index 8dc9ed6..0000000
--- a/src/components/ble/FSService.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-#include <nrf_log.h>
-#include "FSService.h"
-#include "components/ble/BleController.h"
-#include "systemtask/SystemTask.h"
-
-using namespace Pinetime::Controllers;
-
-constexpr ble_uuid16_t FSService::fsServiceUuid;
-constexpr ble_uuid128_t FSService::fsVersionUuid;
-constexpr ble_uuid128_t FSService::fsTransferUuid;
-
-int FSServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
- auto* fsService = static_cast<FSService*>(arg);
- return fsService->OnFSServiceRequested(conn_handle, attr_handle, ctxt);
-}
-
-FSService::FSService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::FS& fs)
- : systemTask {systemTask},
- fs {fs},
- characteristicDefinition {{.uuid = &fsVersionUuid.u,
- .access_cb = FSServiceCallback,
- .arg = this,
- .flags = BLE_GATT_CHR_F_READ,
- .val_handle = &versionCharacteristicHandle},
- {
- .uuid = &fsTransferUuid.u,
- .access_cb = FSServiceCallback,
- .arg = this,
- .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY,
- .val_handle = &transferCharacteristicHandle,
- },
- {0}},
- serviceDefinition {
- {/* Device Information Service */
- .type = BLE_GATT_SVC_TYPE_PRIMARY,
- .uuid = &fsServiceUuid.u,
- .characteristics = characteristicDefinition},
- {0},
- } {
-}
-
-void FSService::Init() {
- int res = 0;
- res = ble_gatts_count_cfg(serviceDefinition);
- ASSERT(res == 0);
-
- res = ble_gatts_add_svcs(serviceDefinition);
- ASSERT(res == 0);
-}
-
-int FSService::OnFSServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) {
- if (attributeHandle == versionCharacteristicHandle) {
- NRF_LOG_INFO("FS_S : handle = %d", versionCharacteristicHandle);
- int res = os_mbuf_append(context->om, &fsVersion, sizeof(fsVersion));
- return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
- }
- if (attributeHandle == transferCharacteristicHandle) {
- return FSCommandHandler(connectionHandle, context->om);
- }
- return 0;
-}
-
-int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
- auto command = static_cast<commands>(om->om_data[0]);
- NRF_LOG_INFO("[FS_S] -> FSCommandHandler Command %d", command);
- // Just always make sure we are awake...
- systemTask.PushMessage(Pinetime::System::Messages::StartFileTransfer);
- vTaskDelay(10);
- while (systemTask.IsSleeping()) {
- vTaskDelay(100); // 50ms
- }
- lfs_dir_t dir = {0};
- lfs_info info = {0};
- lfs_file f = {0};
- switch (command) {
- case commands::READ: {
- NRF_LOG_INFO("[FS_S] -> Read");
- auto* header = (ReadHeader*) om->om_data;
- uint16_t plen = header->pathlen;
- if (plen > maxpathlen) { //> counts for null term
- return -1;
- }
- memcpy(filepath, header->pathstr, plen);
- filepath[plen] = 0; // Copy and null teminate string
- ReadResponse resp;
- os_mbuf* om;
- resp.command = commands::READ_DATA;
- resp.status = 0x01;
- resp.chunkoff = header->chunkoff;
- int res = fs.Stat(filepath, &info);
- if (res == LFS_ERR_NOENT && info.type != LFS_TYPE_DIR) {
- resp.status = (int8_t) res;
- resp.chunklen = 0;
- resp.totallen = 0;
- om = ble_hs_mbuf_from_flat(&resp, sizeof(ReadResponse));
- } else {
- resp.chunklen = std::min(header->chunksize, info.size); // TODO add mtu somehow
- resp.totallen = info.size;
- fs.FileOpen(&f, filepath, LFS_O_RDONLY);
- fs.FileSeek(&f, header->chunkoff);
- uint8_t fileData[resp.chunklen] = {0};
- resp.chunklen = fs.FileRead(&f, fileData, resp.chunklen);
- om = ble_hs_mbuf_from_flat(&resp, sizeof(ReadResponse));
- os_mbuf_append(om, fileData, resp.chunklen);
- fs.FileClose(&f);
- }
-
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::READ_PACING: {
- NRF_LOG_INFO("[FS_S] -> Readpacing");
- auto* header = (ReadHeader*) om->om_data;
- ReadResponse resp;
- resp.command = commands::READ_DATA;
- resp.status = 0x01;
- resp.chunkoff = header->chunkoff;
- int res = fs.Stat(filepath, &info);
- if (res == LFS_ERR_NOENT && info.type != LFS_TYPE_DIR) {
- resp.status = (int8_t) res;
- resp.chunklen = 0;
- resp.totallen = 0;
- } else {
- resp.chunklen = std::min(header->chunksize, info.size); // TODO add mtu somehow
- resp.totallen = info.size;
- fs.FileOpen(&f, filepath, LFS_O_RDONLY);
- fs.FileSeek(&f, header->chunkoff);
- }
- os_mbuf* om;
- if (resp.chunklen > 0) {
- uint8_t fileData[resp.chunklen] = {0};
- resp.chunklen = fs.FileRead(&f, fileData, resp.chunklen);
- om = ble_hs_mbuf_from_flat(&resp, sizeof(ReadResponse));
- os_mbuf_append(om, fileData, resp.chunklen);
- } else {
- resp.chunklen = 0;
- om = ble_hs_mbuf_from_flat(&resp, sizeof(ReadResponse));
- }
- fs.FileClose(&f);
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::WRITE: {
- NRF_LOG_INFO("[FS_S] -> Write");
- auto* header = (WriteHeader*) om->om_data;
- uint16_t plen = header->pathlen;
- if (plen > maxpathlen) { //> counts for null term
- return -1; // TODO make this actually return a BLE notif
- }
- memcpy(filepath, header->pathstr, plen);
- filepath[plen] = 0; // Copy and null teminate string
- fileSize = header->totalSize;
- WriteResponse resp;
- resp.command = commands::WRITE_PACING;
- resp.offset = header->offset;
- resp.modTime = 0;
-
- int res = fs.FileOpen(&f, filepath, LFS_O_RDWR | LFS_O_CREAT);
- if (res == 0) {
- fs.FileClose(&f);
- resp.status = (res == 0) ? 0x01 : (int8_t) res;
- }
- resp.freespace = std::min(fs.getSize() - (fs.GetFSSize() * fs.getBlockSize()), fileSize - header->offset);
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(WriteResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::WRITE_DATA: {
- NRF_LOG_INFO("[FS_S] -> WriteData");
- auto* header = (WritePacing*) om->om_data;
- WriteResponse resp;
- resp.command = commands::WRITE_PACING;
- resp.offset = header->offset;
- int res = 0;
-
- if (!(res = fs.FileOpen(&f, filepath, LFS_O_RDWR | LFS_O_CREAT))) {
- if ((res = fs.FileSeek(&f, header->offset)) >= 0) {
- res = fs.FileWrite(&f, header->data, header->dataSize);
- }
- fs.FileClose(&f);
- }
- if (res < 0) {
- resp.status = (int8_t) res;
- }
- resp.freespace = std::min(fs.getSize() - (fs.GetFSSize() * fs.getBlockSize()), fileSize - header->offset);
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(WriteResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::DELETE: {
- NRF_LOG_INFO("[FS_S] -> Delete");
- auto* header = (DelHeader*) om->om_data;
- uint16_t plen = header->pathlen;
- char path[plen + 1] = {0};
- memcpy(path, header->pathstr, plen);
- path[plen] = 0; // Copy and null teminate string
- DelResponse resp {};
- resp.command = commands::DELETE_STATUS;
- int res = fs.FileDelete(path);
- resp.status = (res == 0) ? 0x01 : (int8_t) res;
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(DelResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::MKDIR: {
- NRF_LOG_INFO("[FS_S] -> MKDir");
- auto* header = (MKDirHeader*) om->om_data;
- uint16_t plen = header->pathlen;
- char path[plen + 1] = {0};
- memcpy(path, header->pathstr, plen);
- path[plen] = 0; // Copy and null teminate string
- MKDirResponse resp {};
- resp.command = commands::MKDIR_STATUS;
- resp.modification_time = 0;
- int res = fs.DirCreate(path);
- resp.status = (res == 0) ? 0x01 : (int8_t) res;
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(MKDirResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::LISTDIR: {
- NRF_LOG_INFO("[FS_S] -> ListDir");
- ListDirHeader* header = (ListDirHeader*) om->om_data;
- uint16_t plen = header->pathlen;
- char path[plen + 1] = {0};
- path[plen] = 0; // Copy and null teminate string
- memcpy(path, header->pathstr, plen);
-
- ListDirResponse resp {};
-
- resp.command = commands::LISTDIR_ENTRY;
- resp.status = 0x01;
- resp.totalentries = 0;
- resp.entry = 0;
- resp.modification_time = 0;
- int res = fs.DirOpen(path, &dir);
- if (res != 0) {
- resp.status = (int8_t) res;
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(ListDirResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- };
- while (fs.DirRead(&dir, &info)) {
- resp.totalentries++;
- }
- fs.DirRewind(&dir);
- while (true) {
- res = fs.DirRead(&dir, &info);
- if (res <= 0) {
- break;
- }
- switch (info.type) {
- case LFS_TYPE_REG: {
- resp.flags = 0;
- resp.file_size = info.size;
- break;
- }
- case LFS_TYPE_DIR: {
- resp.flags = 1;
- resp.file_size = 0;
- break;
- }
- }
-
- // strcpy(resp.path, info.name);
- resp.path_length = strlen(info.name);
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(ListDirResponse));
- os_mbuf_append(om, info.name, resp.path_length);
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- /*
- * Todo Figure out how to know when the previous Notify was TX'd
- * For now just delay 100ms to make sure that the data went out...
- */
- vTaskDelay(100); // Allow stuff to actually go out over the BLE conn
- resp.entry++;
- }
- assert(fs.DirClose(&dir) == 0);
- resp.file_size = 0;
- resp.path_length = 0;
- resp.flags = 0;
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(ListDirResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- break;
- }
- case commands::MOVE: {
- NRF_LOG_INFO("[FS_S] -> Move");
- MoveHeader* header = (MoveHeader*) om->om_data;
- uint16_t plen = header->OldPathLength;
- // Null Terminate string
- header->pathstr[plen] = 0;
- char path[header->NewPathLength + 1] = {0};
- memcpy(path, &header->pathstr[plen + 1], header->NewPathLength);
- path[header->NewPathLength] = 0; // Copy and null teminate string
- MoveResponse resp {};
- resp.command = commands::MOVE_STATUS;
- int8_t res = (int8_t) fs.Rename(header->pathstr, path);
- resp.status = (res == 0) ? 1 : res;
- auto* om = ble_hs_mbuf_from_flat(&resp, sizeof(MoveResponse));
- ble_gattc_notify_custom(connectionHandle, transferCharacteristicHandle, om);
- }
- default:
- break;
- }
- NRF_LOG_INFO("[FS_S] -> done ");
- systemTask.PushMessage(Pinetime::System::Messages::StopFileTransfer);
- return 0;
-}
-
-// Loads resp with file data given a valid filepath header and resp
-void FSService::prepareReadDataResp(ReadHeader* header, ReadResponse* resp) {
- // uint16_t plen = header->pathlen;
- resp->command = commands::READ_DATA;
- resp->chunkoff = header->chunkoff;
- resp->status = 0x01;
- struct lfs_info info = {};
- int res = fs.Stat(filepath, &info);
- if (res == LFS_ERR_NOENT && info.type != LFS_TYPE_DIR) {
- resp->status = 0x03;
- resp->chunklen = 0;
- resp->totallen = 0;
- } else {
- lfs_file f;
- resp->chunklen = std::min(header->chunksize, info.size);
- resp->totallen = info.size;
- fs.FileOpen(&f, filepath, LFS_O_RDONLY);
- fs.FileSeek(&f, header->chunkoff);
- resp->chunklen = fs.FileRead(&f, resp->chunk, resp->chunklen);
- fs.FileClose(&f);
- }
-}
diff --git a/src/components/ble/FSService.h b/src/components/ble/FSService.h
deleted file mode 100644
index 828925a..0000000
--- a/src/components/ble/FSService.h
+++ /dev/null
@@ -1,191 +0,0 @@
-#pragma once
-#define min // workaround: nimble's min/max macros conflict with libstdc++
-#define max
-#include <host/ble_gap.h>
-#undef max
-#undef min
-
-#include "components/fs/FS.h"
-
-namespace Pinetime {
- namespace System {
- class SystemTask;
- }
- namespace Controllers {
- class Ble;
- class FSService {
- public:
- FSService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::FS& fs);
- void Init();
-
- int OnFSServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
- void NotifyFSRaw(uint16_t connectionHandle);
-
- private:
- Pinetime::System::SystemTask& systemTask;
- Pinetime::Controllers::FS& fs;
- static constexpr uint16_t FSServiceId {0xFEBB};
- static constexpr uint16_t fsVersionId {0x0100};
- static constexpr uint16_t fsTransferId {0x0200};
- uint16_t fsVersion = {0x0004};
- static constexpr uint16_t maxpathlen = 256;
- static constexpr ble_uuid16_t fsServiceUuid {
- .u {.type = BLE_UUID_TYPE_16},
- .value = {0xFEBB}}; // {0x72, 0x65, 0x66, 0x73, 0x6e, 0x61, 0x72, 0x54, 0x65, 0x6c, 0x69, 0x46, 0xBB, 0xFE, 0xAF, 0xAD}};
-
- static constexpr ble_uuid128_t fsVersionUuid {
- .u {.type = BLE_UUID_TYPE_128},
- .value = {0x72, 0x65, 0x66, 0x73, 0x6e, 0x61, 0x72, 0x54, 0x65, 0x6c, 0x69, 0x46, 0x00, 0x01, 0xAF, 0xAD}};
-
- static constexpr ble_uuid128_t fsTransferUuid {
- .u {.type = BLE_UUID_TYPE_128},
- .value = {0x72, 0x65, 0x66, 0x73, 0x6e, 0x61, 0x72, 0x54, 0x65, 0x6c, 0x69, 0x46, 0x00, 0x02, 0xAF, 0xAD}};
-
- struct ble_gatt_chr_def characteristicDefinition[3];
- struct ble_gatt_svc_def serviceDefinition[2];
- uint16_t versionCharacteristicHandle;
- uint16_t transferCharacteristicHandle;
-
- enum class commands : uint8_t {
- INVALID = 0x00,
- READ = 0x10,
- READ_DATA = 0x11,
- READ_PACING = 0x12,
- WRITE = 0x20,
- WRITE_PACING = 0x21,
- WRITE_DATA = 0x22,
- DELETE = 0x30,
- DELETE_STATUS = 0x31,
- MKDIR = 0x40,
- MKDIR_STATUS = 0x41,
- LISTDIR = 0x50,
- LISTDIR_ENTRY = 0x51,
- MOVE = 0x60,
- MOVE_STATUS = 0x61
- };
- enum class FSState : uint8_t {
- IDLE = 0x00,
- READ = 0x01,
- WRITE = 0x02,
- };
- FSState state;
- char filepath[maxpathlen]; // TODO ..ugh fixed filepath len
- int fileSize;
- using ReadHeader = struct __attribute__((packed)) {
- commands command;
- uint8_t padding;
- uint16_t pathlen;
- uint32_t chunkoff;
- uint32_t chunksize;
- char pathstr[];
- };
-
- using ReadResponse = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- uint16_t padding;
- uint32_t chunkoff;
- uint32_t totallen;
- uint32_t chunklen;
- uint8_t chunk[];
- };
- using ReadPacing = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- uint16_t padding;
- uint32_t chunkoff;
- uint32_t chunksize;
- };
-
- using WriteHeader = struct __attribute__((packed)) {
- commands command;
- uint8_t padding;
- uint16_t pathlen;
- uint32_t offset;
- uint64_t modTime;
- uint32_t totalSize;
- char pathstr[];
- };
-
- using WriteResponse = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- uint16_t padding;
- uint32_t offset;
- uint64_t modTime;
- uint32_t freespace;
- };
-
- using WritePacing = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- uint16_t padding;
- uint32_t offset;
- uint32_t dataSize;
- uint8_t data[];
- };
- using ListDirHeader = struct __attribute__((packed)) {
- commands command;
- uint8_t padding;
- uint16_t pathlen;
- char pathstr[];
- };
-
- using ListDirResponse = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- uint16_t path_length;
- uint32_t entry;
- uint32_t totalentries;
- uint32_t flags;
- uint64_t modification_time;
- uint32_t file_size;
- char path[];
- };
-
- using MKDirHeader = struct __attribute__((packed)) {
- commands command;
- uint8_t padding;
- uint16_t pathlen;
- uint32_t padding2;
- uint64_t time;
- char pathstr[];
- };
-
- using MKDirResponse = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- uint32_t padding1;
- uint16_t padding2;
- uint64_t modification_time;
- };
-
- using DelHeader = struct __attribute__((packed)) {
- commands command;
- uint8_t padding;
- uint16_t pathlen;
- char pathstr[];
- };
-
- using DelResponse = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- };
- using MoveHeader = struct __attribute__((packed)) {
- commands command;
- uint8_t padding;
- uint16_t OldPathLength;
- uint16_t NewPathLength;
- char pathstr[];
- };
-
- using MoveResponse = struct __attribute__((packed)) {
- commands command;
- uint8_t status;
- };
-
- int FSCommandHandler(uint16_t connectionHandle, os_mbuf* om);
- void prepareReadDataResp(ReadHeader* header, ReadResponse* resp);
- };
- }
-}
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index a1597e2..a5bc41b 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -18,7 +18,6 @@
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include "components/datetime/DateTimeController.h"
-#include "components/fs/FS.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
@@ -30,14 +29,12 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
Battery& batteryController,
Pinetime::Drivers::SpiNorFlash& spiNorFlash,
HeartRateController& heartRateController,
- MotionController& motionController,
- FS& fs)
+ MotionController& motionController)
: systemTask {systemTask},
bleController {bleController},
dateTimeController {dateTimeController},
notificationManager {notificationManager},
spiNorFlash {spiNorFlash},
- fs {fs},
dfuService {systemTask, bleController, spiNorFlash},
currentTimeClient {dateTimeController},
@@ -48,7 +45,6 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
immediateAlertService {systemTask, notificationManager},
heartRateService {systemTask, heartRateController},
motionService {systemTask, motionController},
- fsService {systemTask, fs},
serviceDiscovery({&currentTimeClient, &alertNotificationClient}) {
}
@@ -93,7 +89,6 @@ void NimbleController::Init() {
immediateAlertService.Init();
heartRateService.Init();
motionService.Init();
- fsService.Init();
int rc;
rc = ble_hs_util_ensure_addr(0);
diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h
index dfa42f7..263d498 100644
--- a/src/components/ble/NimbleController.h
+++ b/src/components/ble/NimbleController.h
@@ -14,12 +14,10 @@
#include "components/ble/CurrentTimeService.h"
#include "components/ble/DeviceInformationService.h"
#include "components/ble/DfuService.h"
-#include "components/ble/FSService.h"
#include "components/ble/HeartRateService.h"
#include "components/ble/ImmediateAlertService.h"
#include "components/ble/ServiceDiscovery.h"
#include "components/ble/MotionService.h"
-#include "components/fs/FS.h"
namespace Pinetime {
namespace Drivers {
@@ -45,8 +43,7 @@ namespace Pinetime {
Battery& batteryController,
Pinetime::Drivers::SpiNorFlash& spiNorFlash,
HeartRateController& heartRateController,
- MotionController& motionController,
- FS& fs);
+ MotionController& motionController);
void Init();
void StartAdvertising();
int OnGAPEvent(ble_gap_event* event);
@@ -70,7 +67,6 @@ namespace Pinetime {
DateTime& dateTimeController;
NotificationManager& notificationManager;
Pinetime::Drivers::SpiNorFlash& spiNorFlash;
- FS& fs;
DfuService dfuService;
DeviceInformationService deviceInformationService;
@@ -82,7 +78,6 @@ namespace Pinetime {
ImmediateAlertService immediateAlertService;
HeartRateService heartRateService;
MotionService motionService;
- FSService fsService;
ServiceDiscovery serviceDiscovery;
uint8_t addrType;
diff --git a/src/components/fs/FS.cpp b/src/components/fs/FS.cpp
deleted file mode 100644
index 8c98ae3..0000000
--- a/src/components/fs/FS.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-#include "components/fs/FS.h"
-#include <cstring>
-#include <littlefs/lfs.h>
-#include <lvgl/lvgl.h>
-
-using namespace Pinetime::Controllers;
-
-FS::FS(Pinetime::Drivers::SpiNorFlash& driver)
- : flashDriver {driver},
- lfsConfig {
- .context = this,
- .read = SectorRead,
- .prog = SectorProg,
- .erase = SectorErase,
- .sync = SectorSync,
-
- .read_size = 16,
- .prog_size = 8,
- .block_size = blockSize,
- .block_count = size / blockSize,
- .block_cycles = 1000u,
-
- .cache_size = 16,
- .lookahead_size = 16,
-
- .name_max = 50,
- .attr_max = 50,
- } {
-}
-
-void FS::Init() {
-
- // try mount
- int err = lfs_mount(&lfs, &lfsConfig);
-
- // reformat if we can't mount the filesystem
- // this should only happen on the first boot
- if (err != LFS_ERR_OK) {
- lfs_format(&lfs, &lfsConfig);
- err = lfs_mount(&lfs, &lfsConfig);
- if (err != LFS_ERR_OK) {
- return;
- }
- }
-
-#ifndef PINETIME_IS_RECOVERY
- VerifyResource();
- LVGLFileSystemInit();
-#endif
-}
-
-void FS::VerifyResource() {
- // validate the resource metadata
- resourcesValid = true;
-}
-
-int FS::FileOpen(lfs_file_t* file_p, const char* fileName, const int flags) {
- return lfs_file_open(&lfs, file_p, fileName, flags);
-}
-
-int FS::FileClose(lfs_file_t* file_p) {
- return lfs_file_close(&lfs, file_p);
-}
-
-int FS::FileRead(lfs_file_t* file_p, uint8_t* buff, uint32_t size) {
- return lfs_file_read(&lfs, file_p, buff, size);
-}
-
-int FS::FileWrite(lfs_file_t* file_p, const uint8_t* buff, uint32_t size) {
- return lfs_file_write(&lfs, file_p, buff, size);
-}
-
-int FS::FileSeek(lfs_file_t* file_p, uint32_t pos) {
- return lfs_file_seek(&lfs, file_p, pos, LFS_SEEK_SET);
-}
-
-int FS::FileDelete(const char* fileName) {
- return lfs_remove(&lfs, fileName);
-}
-
-int FS::DirOpen(const char* path, lfs_dir_t* lfs_dir) {
- return lfs_dir_open(&lfs, lfs_dir, path);
-}
-
-int FS::DirClose(lfs_dir_t* lfs_dir) {
- return lfs_dir_close(&lfs, lfs_dir);
-}
-
-int FS::DirRead(lfs_dir_t* dir, lfs_info* info) {
- return lfs_dir_read(&lfs, dir, info);
-}
-int FS::DirRewind(lfs_dir_t* dir) {
- return lfs_dir_rewind(&lfs, dir);
-}
-int FS::DirCreate(const char* path) {
- return lfs_mkdir(&lfs, path);
-}
-int FS::Rename(const char* oldPath, const char* newPath){
- return lfs_rename(&lfs,oldPath,newPath);
-}
-int FS::Stat(const char* path, lfs_info* info) {
- return lfs_stat(&lfs, path, info);
-}
-lfs_ssize_t FS::GetFSSize() {
- return lfs_fs_size(&lfs);
-}
-
-/*
-
- ----------- Interface between littlefs and SpiNorFlash -----------
-
-*/
-int FS::SectorSync(const struct lfs_config* c) {
- return 0;
-}
-
-int FS::SectorErase(const struct lfs_config* c, lfs_block_t block) {
- Pinetime::Controllers::FS& lfs = *(static_cast<Pinetime::Controllers::FS*>(c->context));
- const size_t address = startAddress + (block * blockSize);
- lfs.flashDriver.SectorErase(address);
- return lfs.flashDriver.EraseFailed() ? -1 : 0;
-}
-
-int FS::SectorProg(const struct lfs_config* c, lfs_block_t block, lfs_off_t off, const void* buffer, lfs_size_t size) {
- Pinetime::Controllers::FS& lfs = *(static_cast<Pinetime::Controllers::FS*>(c->context));
- const size_t address = startAddress + (block * blockSize) + off;
- lfs.flashDriver.Write(address, (uint8_t*) buffer, size);
- return lfs.flashDriver.ProgramFailed() ? -1 : 0;
-}
-
-int FS::SectorRead(const struct lfs_config* c, lfs_block_t block, lfs_off_t off, void* buffer, lfs_size_t size) {
- Pinetime::Controllers::FS& lfs = *(static_cast<Pinetime::Controllers::FS*>(c->context));
- const size_t address = startAddress + (block * blockSize) + off;
- lfs.flashDriver.Read(address, static_cast<uint8_t*>(buffer), size);
- return 0;
-}
-
-/*
-
- ----------- LVGL filesystem integration -----------
-
-*/
-
-namespace {
- lv_fs_res_t lvglOpen(lv_fs_drv_t* drv, void* file_p, const char* path, lv_fs_mode_t mode) {
- lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
- FS* filesys = static_cast<FS*>(drv->user_data);
- int res = filesys->FileOpen(file, path, LFS_O_RDONLY);
- if (res == 0) {
- if (file->type == 0) {
- return LV_FS_RES_FS_ERR;
- } else {
- return LV_FS_RES_OK;
- }
- }
- return LV_FS_RES_NOT_EX;
- }
-
- lv_fs_res_t lvglClose(lv_fs_drv_t* drv, void* file_p) {
- FS* filesys = static_cast<FS*>(drv->user_data);
- lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
- filesys->FileClose(file);
-
- return LV_FS_RES_OK;
- }
-
- lv_fs_res_t lvglRead(lv_fs_drv_t* drv, void* file_p, void* buf, uint32_t btr, uint32_t* br) {
- FS* filesys = static_cast<FS*>(drv->user_data);
- lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
- filesys->FileRead(file, static_cast<uint8_t*>(buf), btr);
- *br = btr;
- return LV_FS_RES_OK;
- }
-
- lv_fs_res_t lvglSeek(lv_fs_drv_t* drv, void* file_p, uint32_t pos) {
- FS* filesys = static_cast<FS*>(drv->user_data);
- lfs_file_t* file = static_cast<lfs_file_t*>(file_p);
- filesys->FileSeek(file, pos);
- return LV_FS_RES_OK;
- }
-}
-
-void FS::LVGLFileSystemInit() {
-
- lv_fs_drv_t fs_drv;
- lv_fs_drv_init(&fs_drv);
-
- fs_drv.file_size = sizeof(lfs_file_t);
- fs_drv.letter = 'F';
- fs_drv.open_cb = lvglOpen;
- fs_drv.close_cb = lvglClose;
- fs_drv.read_cb = lvglRead;
- fs_drv.seek_cb = lvglSeek;
-
- fs_drv.user_data = this;
-
- lv_fs_drv_register(&fs_drv);
-} \ No newline at end of file
diff --git a/src/components/fs/FS.h b/src/components/fs/FS.h
deleted file mode 100644
index 2b27ae5..0000000
--- a/src/components/fs/FS.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include "drivers/SpiNorFlash.h"
-#include <littlefs/lfs.h>
-
-namespace Pinetime {
- namespace Controllers {
- class FS {
- public:
- FS(Pinetime::Drivers::SpiNorFlash&);
-
- void Init();
- void LVGLFileSystemInit();
-
- int FileOpen(lfs_file_t* file_p, const char* fileName, const int flags);
- int FileClose(lfs_file_t* file_p);
- int FileRead(lfs_file_t* file_p, uint8_t* buff, uint32_t size);
- int FileWrite(lfs_file_t* file_p, const uint8_t* buff, uint32_t size);
- int FileSeek(lfs_file_t* file_p, uint32_t pos);
-
- int FileDelete(const char* fileName);
-
- int DirOpen(const char* path, lfs_dir_t* lfs_dir);
- int DirClose(lfs_dir_t* lfs_dir);
- int DirRead(lfs_dir_t* dir, lfs_info* info);
- int DirRewind(lfs_dir_t* dir);
- int DirCreate(const char* path);
-
- lfs_ssize_t GetFSSize();
- int Rename(const char* oldPath, const char* newPath);
- int Stat(const char* path, lfs_info* info);
- void VerifyResource();
-
- static size_t getSize() {
- return size;
- }
- static size_t getBlockSize() {
- return blockSize;
- }
-
- private:
- Pinetime::Drivers::SpiNorFlash& flashDriver;
-
- /*
- * External Flash MAP (4 MBytes)
- *
- * 0x000000 +---------------------------------------+
- * | Bootloader Assets |
- * | 256 KBytes |
- * | |
- * 0x040000 +---------------------------------------+
- * | OTA |
- * | 464 KBytes |
- * | |
- * | |
- * | |
- * 0x0B4000 +---------------------------------------+
- * | File System |
- * | |
- * | |
- * | |
- * | |
- * 0x400000 +---------------------------------------+
- *
- */
- static constexpr size_t startAddress = 0x0B4000;
- static constexpr size_t size = 0x34C000;
- static constexpr size_t blockSize = 4096;
-
- bool resourcesValid = false;
- const struct lfs_config lfsConfig;
-
- lfs_t lfs;
-
- static int SectorSync(const struct lfs_config* c);
- static int SectorErase(const struct lfs_config* c, lfs_block_t block);
- static int SectorProg(const struct lfs_config* c, lfs_block_t block, lfs_off_t off, const void* buffer, lfs_size_t size);
- static int SectorRead(const struct lfs_config* c, lfs_block_t block, lfs_off_t off, void* buffer, lfs_size_t size);
- };
- }
-}
diff --git a/src/components/settings/Settings.cpp b/src/components/settings/Settings.cpp
index fee62da..69d9907 100644
--- a/src/components/settings/Settings.cpp
+++ b/src/components/settings/Settings.cpp
@@ -4,44 +4,9 @@
using namespace Pinetime::Controllers;
-Settings::Settings(Pinetime::Controllers::FS& fs) : fs {fs} {
-}
+Settings::Settings() {}
-void Settings::Init() {
+void Settings::Init() {}
- // Load default settings from Flash
- LoadSettingsFromFile();
-}
+void Settings::SaveSettings() {}
-void Settings::SaveSettings() {
-
- // verify if is necessary to save
- if (settingsChanged) {
- SaveSettingsToFile();
- }
- settingsChanged = false;
-}
-
-void Settings::LoadSettingsFromFile() {
- SettingsData bufferSettings;
- lfs_file_t settingsFile;
-
- if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDONLY) != LFS_ERR_OK) {
- return;
- }
- fs.FileRead(&settingsFile, reinterpret_cast<uint8_t*>(&bufferSettings), sizeof(settings));
- fs.FileClose(&settingsFile);
- if ( bufferSettings.version == settingsVersion ) {
- settings = bufferSettings;
- }
-}
-
-void Settings::SaveSettingsToFile() {
- lfs_file_t settingsFile;
-
- if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) {
- return;
- }
- fs.FileWrite(&settingsFile, reinterpret_cast<uint8_t*>(&settings), sizeof(settings));
- fs.FileClose(&settingsFile);
-}
diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h
index 3b26d69..2d26664 100644
--- a/src/components/settings/Settings.h
+++ b/src/components/settings/Settings.h
@@ -2,7 +2,6 @@
#include <cstdint>
#include <bitset>
#include "components/brightness/BrightnessController.h"
-#include "components/fs/FS.h"
namespace Pinetime {
namespace Controllers {
@@ -36,7 +35,7 @@ namespace Pinetime {
Orange
};
- Settings(Pinetime::Controllers::FS& fs);
+ Settings();
void Init();
void SaveSettings();
@@ -160,8 +159,6 @@ namespace Pinetime {
};
private:
- Pinetime::Controllers::FS& fs;
-
static constexpr uint32_t settingsVersion = 0x4001; // infinitime redux settings
struct SettingsData {
uint32_t version = settingsVersion;
@@ -184,8 +181,6 @@ namespace Pinetime {
uint8_t appMenu = 0;
uint8_t settingsMenu = 0;
- void LoadSettingsFromFile();
- void SaveSettingsToFile();
};
}
}
diff --git a/src/main.cpp b/src/main.cpp
index ec11099..c41dfc4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -37,7 +37,6 @@
#include "components/motor/MotorController.h"
#include "components/datetime/DateTimeController.h"
#include "components/heartrate/HeartRateController.h"
-#include "components/fs/FS.h"
#include "drivers/Spi.h"
#include "drivers/SpiMaster.h"
#include "drivers/SpiNorFlash.h"
@@ -102,8 +101,7 @@ Pinetime::Controllers::Ble bleController;
Pinetime::Controllers::HeartRateController heartRateController;
Pinetime::Applications::HeartRateTask heartRateApp(heartRateSensor, heartRateController);
-Pinetime::Controllers::FS fs {spiNorFlash};
-Pinetime::Controllers::Settings settingsController {fs};
+Pinetime::Controllers::Settings settingsController {};
Pinetime::Controllers::MotorController motorController {};
Pinetime::Controllers::DateTime dateTimeController {settingsController};
@@ -152,7 +150,6 @@ Pinetime::System::SystemTask systemTask(spi,
heartRateController,
displayApp,
heartRateApp,
- fs,
touchHandler,
buttonHandler);
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index a81950d..7e59690 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -66,7 +66,6 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
Pinetime::Controllers::HeartRateController& heartRateController,
Pinetime::Applications::DisplayApp& displayApp,
Pinetime::Applications::HeartRateTask& heartRateApp,
- Pinetime::Controllers::FS& fs,
Pinetime::Controllers::TouchHandler& touchHandler,
Pinetime::Controllers::ButtonHandler& buttonHandler)
: spi {spi},
@@ -89,7 +88,6 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
motionController {motionController},
displayApp {displayApp},
heartRateApp(heartRateApp),
- fs {fs},
touchHandler {touchHandler},
buttonHandler {buttonHandler},
nimbleController(*this,
@@ -99,8 +97,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
batteryController,
spiNorFlash,
heartRateController,
- motionController,
- fs) {
+ motionController) {
}
void SystemTask::Start() {
@@ -128,8 +125,6 @@ void SystemTask::Work() {
spiNorFlash.Init();
spiNorFlash.Wakeup();
- fs.Init();
-
nimbleController.Init();
lcd.Init();
@@ -325,19 +320,6 @@ void SystemTask::Work() {
doNotGoToSleep = false;
xTimerStart(dimTimer, 0);
break;
- case Messages::StartFileTransfer:
- NRF_LOG_INFO("[systemtask] FS Started");
- doNotGoToSleep = true;
- if (isSleeping && !isWakingUp)
- GoToRunning();
- // TODO add intent of fs access icon or something
- break;
- case Messages::StopFileTransfer:
- NRF_LOG_INFO("[systemtask] FS Stopped");
- doNotGoToSleep = false;
- xTimerStart(dimTimer, 0);
- // TODO add intent of fs access icon or something
- break;
case Messages::OnTouchEvent:
if (touchHandler.GetNewTouchInfo()) {
touchHandler.UpdateLvglTouchPoint();
diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h
index e984264..3bba716 100644
--- a/src/systemtask/SystemTask.h
+++ b/src/systemtask/SystemTask.h
@@ -17,7 +17,6 @@
#include "components/ble/NotificationManager.h"
#include "components/motor/MotorController.h"
#include "components/alarm/AlarmController.h"
-#include "components/fs/FS.h"
#include "touchhandler/TouchHandler.h"
#include "buttonhandler/ButtonHandler.h"
#include "buttonhandler/ButtonActions.h"
@@ -72,7 +71,6 @@ namespace Pinetime {
Pinetime::Controllers::HeartRateController& heartRateController,
Pinetime::Applications::DisplayApp& displayApp,
Pinetime::Applications::HeartRateTask& heartRateApp,
- Pinetime::Controllers::FS& fs,
Pinetime::Controllers::TouchHandler& touchHandler,
Pinetime::Controllers::ButtonHandler& buttonHandler);
@@ -122,7 +120,6 @@ namespace Pinetime {
Pinetime::Applications::DisplayApp& displayApp;
Pinetime::Applications::HeartRateTask& heartRateApp;
- Pinetime::Controllers::FS& fs;
Pinetime::Controllers::TouchHandler& touchHandler;
Pinetime::Controllers::ButtonHandler& buttonHandler;
Pinetime::Controllers::NimbleController nimbleController;