|
|
@@ -12,15 +12,12 @@ enum SubmenuIndex {
|
|
|
SubmenuIndexInspect,
|
|
|
};
|
|
|
|
|
|
-static SeosHci* seos_hci = NULL;
|
|
|
-static int8_t ble_checks;
|
|
|
-
|
|
|
void seos_scene_start_submenu_callback(void* context, uint32_t index) {
|
|
|
Seos* seos = context;
|
|
|
view_dispatcher_send_custom_event(seos->view_dispatcher, index);
|
|
|
}
|
|
|
|
|
|
-void seos_scene_start_on_update(void* context) {
|
|
|
+void seos_scene_start_on_enter(void* context) {
|
|
|
Seos* seos = context;
|
|
|
Submenu* submenu = seos->submenu;
|
|
|
submenu_reset(submenu);
|
|
|
@@ -61,18 +58,6 @@ void seos_scene_start_on_update(void* context) {
|
|
|
view_dispatcher_switch_to_view(seos->view_dispatcher, SeosViewMenu);
|
|
|
}
|
|
|
|
|
|
-void seos_scene_start_on_enter(void* context) {
|
|
|
- Seos* seos = context;
|
|
|
- // Dont' check if we've checked before
|
|
|
- if(seos->has_ble == false) {
|
|
|
- ble_checks = 3;
|
|
|
- seos_hci = seos_hci_alloc(seos);
|
|
|
- seos_hci_start(seos_hci, BLE_PERIPHERAL, FLOW_TEST);
|
|
|
- }
|
|
|
-
|
|
|
- seos_scene_start_on_update(context);
|
|
|
-}
|
|
|
-
|
|
|
bool seos_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|
|
Seos* seos = context;
|
|
|
bool consumed = false;
|
|
|
@@ -113,23 +98,6 @@ bool seos_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|
|
scene_manager_set_scene_state(seos->scene_manager, SeosSceneStart, SubmenuIndexAbout);
|
|
|
scene_manager_next_scene(seos->scene_manager, SeosSceneAbout);
|
|
|
consumed = true;
|
|
|
- } else if(event.event == SeosCustomEventHCIInit) {
|
|
|
- seos->has_ble = true;
|
|
|
- FURI_LOG_I(TAG, "HCI Init");
|
|
|
- if(seos_hci) {
|
|
|
- seos_hci_stop(seos_hci);
|
|
|
- seos_hci_free(seos_hci);
|
|
|
- seos_hci = NULL;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if(event.type == SceneManagerEventTypeTick) {
|
|
|
- if(ble_checks > 0) {
|
|
|
- FURI_LOG_D(TAG, "ble check %d has_ble %d", ble_checks, seos->has_ble);
|
|
|
- ble_checks--;
|
|
|
- if(seos->has_ble) {
|
|
|
- ble_checks = 0;
|
|
|
- seos_scene_start_on_update(context);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -139,11 +107,5 @@ bool seos_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|
|
void seos_scene_start_on_exit(void* context) {
|
|
|
Seos* seos = context;
|
|
|
|
|
|
- if(seos_hci) {
|
|
|
- seos_hci_stop(seos_hci);
|
|
|
- seos_hci_free(seos_hci);
|
|
|
- seos_hci = NULL;
|
|
|
- }
|
|
|
-
|
|
|
submenu_reset(seos->submenu);
|
|
|
}
|