From 88cf76b07eb280d135df01b51b6a14dcbbf7a679 Mon Sep 17 00:00:00 2001 From: AdonaiDiazEsparza Date: Thu, 31 Oct 2024 10:46:25 -0600 Subject: [PATCH 1/3] fix: more time added to send correctly a CAN message --- Canbus_app/.gitignore | 3 +++ Canbus_app/libraries/mcp_can_2515.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Canbus_app/.gitignore b/Canbus_app/.gitignore index dd6a475..88f594e 100644 --- a/Canbus_app/.gitignore +++ b/Canbus_app/.gitignore @@ -5,3 +5,6 @@ dist/* .editorconfig .env .ufbt + +# Ignore the makefile +Makefile diff --git a/Canbus_app/libraries/mcp_can_2515.c b/Canbus_app/libraries/mcp_can_2515.c index 30fd535..3bad26c 100644 --- a/Canbus_app/libraries/mcp_can_2515.c +++ b/Canbus_app/libraries/mcp_can_2515.c @@ -625,10 +625,10 @@ ERROR_CAN send_can_message(FuriHalSpiBusHandle* spi, CANFRAME* frame, uint8_t tx furi_hal_spi_release(spi); - read_register(spi, free_buffer - 1, &is_send_it); + furi_delay_us(1); if(is_send_it == 0) res = ERROR_OK; - } while((res != ERROR_OK) && ((furi_get_tick() - time_waiting) < 1)); + } while((res != ERROR_OK) && ((furi_get_tick() - time_waiting) < 5)); if(is_send_it) return res; From 6d4bdb669386e61f357b5cafad9b6dd0a5bdd97e Mon Sep 17 00:00:00 2001 From: AdonaiDiazEsparza Date: Thu, 31 Oct 2024 11:00:07 -0600 Subject: [PATCH 2/3] fix: get the ECU message & change text version --- Canbus_app/libraries/pid_library.c | 2 +- Canbus_app/scenes/AboutUs.c | 2 +- Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Canbus_app/libraries/pid_library.c b/Canbus_app/libraries/pid_library.c index a82648a..2736d53 100644 --- a/Canbus_app/libraries/pid_library.c +++ b/Canbus_app/libraries/pid_library.c @@ -106,7 +106,7 @@ bool read_frames(MCP2515* CAN, CANFRAME* frame) { uint32_t time_delay = 0; do { - if(read_can_message(CAN, frame)) { + if(read_can_message(CAN, frame) == ERROR_OK) { if(frame->canId == 0x7e8) return true; } furi_delay_us(1); diff --git a/Canbus_app/scenes/AboutUs.c b/Canbus_app/scenes/AboutUs.c index efc65a7..04b613b 100644 --- a/Canbus_app/scenes/AboutUs.c +++ b/Canbus_app/scenes/AboutUs.c @@ -32,7 +32,7 @@ static void draw_can_app_view(App* app) { widget_add_string_element( app->widget, 65, 20, AlignCenter, AlignCenter, FontPrimary, "CANBUS APP"); widget_add_string_element( - app->widget, 65, 35, AlignCenter, AlignCenter, FontSecondary, "v1.2"); + app->widget, 65, 35, AlignCenter, AlignCenter, FontSecondary, "v1.1.3"); widget_add_button_element(app->widget, GuiButtonTypeRight, "Next", button_callback, app); widget_add_button_element(app->widget, GuiButtonTypeLeft, "Prev", button_callback, app); diff --git a/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c b/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c index 4ec626b..3f6a098 100644 --- a/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c +++ b/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c @@ -116,7 +116,7 @@ void app_scene_manual_sender_pid_on_enter(void* context) { furi_string_reset(text); furi_string_cat_printf(text, "%u", count_of_bytes); item = variable_item_list_add( - app->varList, "Count Bytes", 7, callback_manual_pid_sender_options, app); + app->varList, "Count Bytes", 3, callback_manual_pid_sender_options, app); variable_item_set_current_value_index(item, 0); variable_item_set_current_value_text(item, furi_string_get_cstr(text)); variable_item_set_current_value_index(item, count_of_bytes); From f2adc357c5925152782fc68dc5437c5788fa1df3 Mon Sep 17 00:00:00 2001 From: AdonaiDiazEsparza Date: Fri, 1 Nov 2024 12:35:46 -0600 Subject: [PATCH 3/3] fix: real count of services in pid manual sender --- Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c b/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c index 3f6a098..024ca63 100644 --- a/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c +++ b/Canbus_app/scenes/Obd2Options/manualPIDSenderOption.c @@ -108,7 +108,7 @@ void app_scene_manual_sender_pid_on_enter(void* context) { furi_string_reset(text); furi_string_cat_printf(text, "0x%x", service_to_send); item = variable_item_list_add( - app->varList, "Service", 96, callback_manual_pid_sender_options, app); + app->varList, "Service", 11, callback_manual_pid_sender_options, app); variable_item_set_current_value_index(item, service_to_send); variable_item_set_current_value_text(item, furi_string_get_cstr(text));