App iButton: fix cli delete command bug, use RAII records (#523)
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
57bde875eb
commit
2084f83eb5
@ -28,25 +28,18 @@ void iButtonApp::run(void) {
|
|||||||
scenes[current_scene]->on_exit(this);
|
scenes[current_scene]->on_exit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
iButtonApp::iButtonApp() {
|
iButtonApp::iButtonApp()
|
||||||
|
: fs_api{"sdcard"}
|
||||||
|
, sd_ex_api{"sdcard-ex"}
|
||||||
|
, notification{"notification"} {
|
||||||
api_hal_power_insomnia_enter();
|
api_hal_power_insomnia_enter();
|
||||||
|
|
||||||
key_worker = new KeyWorker(&ibutton_gpio);
|
key_worker = new KeyWorker(&ibutton_gpio);
|
||||||
sd_ex_api = static_cast<SdCard_Api*>(furi_record_open("sdcard-ex"));
|
|
||||||
fs_api = static_cast<FS_Api*>(furi_record_open("sdcard"));
|
|
||||||
notification = static_cast<NotificationApp*>(furi_record_open("notification"));
|
|
||||||
|
|
||||||
// we need random
|
// we need random
|
||||||
srand(DWT->CYCCNT);
|
srand(DWT->CYCCNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
iButtonApp::~iButtonApp() {
|
iButtonApp::~iButtonApp() {
|
||||||
cli_delete_command(cli, "tm");
|
|
||||||
|
|
||||||
furi_record_close("sdcard-ex");
|
|
||||||
furi_record_close("sdcard");
|
|
||||||
furi_record_close("notification");
|
|
||||||
|
|
||||||
for(std::map<Scene, iButtonScene*>::iterator it = scenes.begin(); it != scenes.end(); ++it) {
|
for(std::map<Scene, iButtonScene*>::iterator it = scenes.begin(); it != scenes.end(); ++it) {
|
||||||
delete it->second;
|
delete it->second;
|
||||||
scenes.erase(it);
|
scenes.erase(it);
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include <notification/notification-messages.h>
|
#include <notification/notification-messages.h>
|
||||||
|
|
||||||
|
#include <record-controller.hpp>
|
||||||
|
|
||||||
class iButtonApp {
|
class iButtonApp {
|
||||||
public:
|
public:
|
||||||
void run(void);
|
void run(void);
|
||||||
@ -130,17 +132,16 @@ private:
|
|||||||
|
|
||||||
iButtonKey key;
|
iButtonKey key;
|
||||||
|
|
||||||
SdCard_Api* sd_ex_api;
|
RecordController<FS_Api> fs_api;
|
||||||
FS_Api* fs_api;
|
RecordController<SdCard_Api> sd_ex_api;
|
||||||
Cli* cli;
|
RecordController<NotificationApp> notification;
|
||||||
|
|
||||||
static const uint8_t file_name_size = 100;
|
static const uint8_t file_name_size = 100;
|
||||||
char file_name[file_name_size];
|
char file_name[file_name_size];
|
||||||
|
|
||||||
static const uint8_t text_store_size = 128;
|
static const uint8_t text_store_size = 128;
|
||||||
char text_store[text_store_size + 1];
|
char text_store[text_store_size + 1];
|
||||||
|
|
||||||
NotificationApp* notification;
|
|
||||||
|
|
||||||
static const char* app_folder;
|
static const char* app_folder;
|
||||||
static const char* app_extension;
|
static const char* app_extension;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user