Skip to content

Commit

Permalink
feat: add functions for the speed detector
Browse files Browse the repository at this point in the history
  • Loading branch information
AdonaiDiazEsparza committed Dec 9, 2024
1 parent 1280df5 commit 9346419
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Canbus_app/app_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ typedef struct {
// This is for the menu Options
typedef enum {
SniffingTestOption,
SpeedDetectorOption,
SenderOption,
ObdiiOption,
UDSOption,
Expand All @@ -112,6 +113,7 @@ typedef enum {
// These are the events on the main menu
typedef enum {
SniffingOptionEvent,
SpeedDetectorEvent,
SenderOptionEvent,
SettingsOptionEvent,
ObdiiOptionEvent,
Expand Down
Binary file modified Canbus_app/dist/canbus_app.fap
Binary file not shown.
Binary file modified Canbus_app/dist/debug/canbus_app_d.elf
Binary file not shown.
35 changes: 35 additions & 0 deletions Canbus_app/scenes/DetectorSpeedOption.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "../app_user.h"

static int32_t thread_to_detect_speed(void* context);

void app_scene_speed_detector_on_enter(void* context) {
App* app = context;
widget_reset(app->widget);
app->thread = furi_thread_alloc_ex("Auto-detector Speed", 1024, thread_to_detect_speed, app);
furi_thread_start(app->thread);

draw_in_development(app);

view_dispatcher_switch_to_view(app->view_dispatcher, ViewWidget);
}

bool app_scene_speed_detector_on_event(void* context, SceneManagerEvent event) {
App* app = context;
UNUSED(app);
UNUSED(event);
bool consumed = false;
return consumed;
}

void app_scene_speed_detector_on_exit(void* context) {
App* app = context;
furi_thread_join(app->thread);
furi_thread_free(app->thread);
widget_reset(app->widget);
}

static int32_t thread_to_detect_speed(void* context) {
App* app = context;
UNUSED(app);
return 0;
}
12 changes: 12 additions & 0 deletions Canbus_app/scenes/mainMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ void basic_scenes_menu_callback(void* context, uint32_t index) {
scene_manager_handle_custom_event(app->scene_manager, SniffingOptionEvent);
break;

case SpeedDetectorOption:
scene_manager_handle_custom_event(app->scene_manager, SpeedDetectorEvent);
break;

case SenderOption:
scene_manager_handle_custom_event(app->scene_manager, SenderOptionEvent);
break;
Expand Down Expand Up @@ -114,6 +118,9 @@ void app_scene_menu_on_enter(void* context) {
submenu_add_item(
app->submenu, "Sniffing", SniffingTestOption, basic_scenes_menu_callback, app);

submenu_add_item(
app->submenu, "SpeedDetector", SpeedDetectorOption, basic_scenes_menu_callback, app);

submenu_add_item(app->submenu, "Sender", SenderOption, basic_scenes_menu_callback, app);

submenu_add_item(app->submenu, "Player", PlayLOGOption, basic_scenes_menu_callback, app);
Expand Down Expand Up @@ -147,6 +154,11 @@ bool app_scene_menu_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;

case SpeedDetectorEvent:
scene_manager_next_scene(app->scene_manager, app_scene_speed_detector_option);
consumed = true;
break;

case SenderOptionEvent:
scene_manager_next_scene(app->scene_manager, app_scene_sender_option);
break;
Expand Down
5 changes: 5 additions & 0 deletions Canbus_app/scenes_config/app_scene_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ ADD_SCENE(app, menu, main_menu)
ADD_SCENE(app, sniffing, sniffing_option)
ADD_SCENE(app, box_sniffing, box_sniffing)
ADD_SCENE(app, device_no_connected, device_no_connected)

// --------------------------------------------------------------
ADD_SCENE(app, speed_detector, speed_detector_option)
// --------------------------------------------------------------

ADD_SCENE(app, sender, sender_option)
ADD_SCENE(app, set_timing, set_timing_option)
ADD_SCENE(app, set_data_sender, set_data_sender_option)
Expand Down

0 comments on commit 9346419

Please sign in to comment.