Skip to content

Commit

Permalink
feat: display waiting data on typical obd2 data & display file no ope…
Browse files Browse the repository at this point in the history
…ned on player
  • Loading branch information
AdonaiDiazEsparza committed Oct 29, 2024
1 parent e5badb0 commit 39ab583
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
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.
11 changes: 10 additions & 1 deletion Canbus_app/scenes/Obd2Options/typicalPIDOption.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void draw_value(App* app, const char* text) {
widget_add_string_element(app->widget, 65, 45, AlignCenter, AlignBottom, FontPrimary, text);
}

// Draws the calculated engine load
// Draws the data
void draw_scene(App* app, uint8_t selector, uint16_t variable) {
FuriString* text_label = app->text;

Expand Down Expand Up @@ -129,6 +129,13 @@ void draw_scene(App* app, uint8_t selector, uint16_t variable) {
draw_value(app, furi_string_get_cstr(text_label));
}

// Draw the waiting data
void draw_waiting_data(App* app) {
widget_reset(app->widget);
widget_add_string_element(
app->widget, 64, 32, AlignCenter, AlignCenter, FontPrimary, "Waiting Data");
}

// Scene on enter
void app_scene_draw_obdii_on_enter(void* context) {
App* app = context;
Expand Down Expand Up @@ -220,6 +227,8 @@ static int32_t obdii_thread_on_work(void* context) {
draw_device_no_connected(app);
}

draw_waiting_data(app);

while(state && furi_hal_gpio_read(&gpio_button_back)) {
if((furi_get_tick() - time_delay) > 10) {
message = pid_show_data(&scanner, request, data, 8);
Expand Down
17 changes: 4 additions & 13 deletions Canbus_app/scenes/playLogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ void draw_starting_transmition(App* app) {
void play_data_frames_bk(void* context, int frame_interval) {
App* app = context;

log_info("Here 0");

app->mcp_can->mode = MCP_NORMAL;
ERROR_CAN debug = ERROR_OK;
debug = mcp2515_init(app->mcp_can);
Expand All @@ -164,16 +162,14 @@ void play_data_frames_bk(void* context, int frame_interval) {

if(!storage_file_open(
app->log_file, furi_string_get_cstr(app->path), FSAM_READ, FSOM_OPEN_EXISTING)) {
log_exception("FILE CANNOT BE OPENED");
draw_file_no_opened(app);
return;
}

draw_starting_transmition(app);

char buffer[256];
//char next_buffer[256];
size_t buffer_index = 0;
//size_t next_buffer_index = 0;
size_t bytes_read;
char c;

Expand All @@ -199,9 +195,6 @@ void play_data_frames_bk(void* context, int frame_interval) {
}
buffer[buffer_index] = '\0';

// If we have a complete line, try to read next frame
log_info("Current frame: %s", buffer);

// Process current frame
CANFRAME frame_to_send = {0};
char* saveptr;
Expand All @@ -211,7 +204,6 @@ void play_data_frames_bk(void* context, int frame_interval) {
// Get current timestamp
token = custom_strtok_r(buffer, "() ", &saveptr);
if(!token) break;
// current_timestamp = strtod(token, &endptr);

// Get next timestamp if available
uint32_t delay_ms = strtod(token, &endptr);
Expand Down Expand Up @@ -305,9 +297,6 @@ void play_data_frames_bk(void* context, int frame_interval) {
// Thread work
int32_t thread_play_logs(void* context) {
App* app = context;

log_info("Entra al hilo");

play_data_frames_bk(app, app->config_timing_index);

return 0;
Expand Down Expand Up @@ -490,7 +479,7 @@ void file_browser_callback(void* context) {
scene_manager_previous_scene(app->scene_manager);
}

// File Browser
// File Browser scene on enter
void app_scene_file_browser_on_enter(void* context) {
App* app = context;
file_browser_configure(app->file_browser, ".log", PATHLOGS, true, true, NULL, true);
Expand All @@ -503,6 +492,7 @@ void app_scene_file_browser_on_enter(void* context) {
view_dispatcher_switch_to_view(app->view_dispatcher, FileBrowserView);
}

// File browser scene on event
bool app_scene_file_browser_on_event(void* context, SceneManagerEvent event) {
App* app = context;
bool consumed = false;
Expand All @@ -512,6 +502,7 @@ bool app_scene_file_browser_on_event(void* context, SceneManagerEvent event) {
return consumed;
}

// File browser on exit
void app_scene_file_browser_on_exit(void* context) {
App* app = context;
UNUSED(app);
Expand Down

0 comments on commit 39ab583

Please sign in to comment.