From c94230c0d2c6b34a8519e70397ebbd4e7a7ca017 Mon Sep 17 00:00:00 2001 From: r3n33 Date: Sat, 4 Sep 2021 18:18:35 -0500 Subject: [PATCH 1/9] Remove debugging on efficiency --- main/display.c | 1 - 1 file changed, 1 deletion(-) diff --git a/main/display.c b/main/display.c index 521a8b0..b9280fd 100644 --- a/main/display.c +++ b/main/display.c @@ -621,7 +621,6 @@ TickType_t drawScreenSecondary(TFT_t * dev, FontxFile *fx, int width, int height if (user_settings->display_mph) efficiency = (esc_telemetry.watt_hours - esc_telemetry.watt_hours_charged) / (esc_telemetry.tachometer_abs / 1000.0 * KTOM); else efficiency = (esc_telemetry.watt_hours - esc_telemetry.watt_hours_charged) / (esc_telemetry.tachometer_abs / 1000.0); if (isnan(efficiency)) efficiency = 0; - efficiency += 10; //TODO: Do we need a minimum distance? esc_telemetry.tachometer_abs / 1000.0 < 0.01 fontWidth = 2; From bf3b45456a675f491979f3bb324b6a56af96fc44 Mon Sep 17 00:00:00 2001 From: r3n33 Date: Sat, 4 Sep 2021 18:22:08 -0500 Subject: [PATCH 2/9] Version 0.1.1 --- main/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/main.c b/main/main.c index e8251d7..f9c623c 100644 --- a/main/main.c +++ b/main/main.c @@ -23,7 +23,7 @@ #include "lib/haptic/haptic.h" -const char * version = "0.1.0"; +const char * version = "0.1.1"; int gyro_x, gyro_y, gyro_z; float accel_g_x, accel_g_x_delta; From d37dcc080f9b21ef52c5d7ce7887528dbb026c37 Mon Sep 17 00:00:00 2001 From: r3n33 Date: Mon, 6 Sep 2021 15:48:50 -0500 Subject: [PATCH 3/9] Update Throttle Lock melody --- main/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/main.c b/main/main.c index f9c623c..4b9d82e 100644 --- a/main/main.c +++ b/main/main.c @@ -256,15 +256,18 @@ static void gpio_input_task(void* arg) } if ((ev.pin == GPIO_INPUT_IO_0) && (ev.event == BUTTON_DOUBLE_CLICK)) { // SW3 on HW v1.2 PCB - melody_play(MELODY_STARTUP, true); - haptic_play(MELODY_STARTUP, true); is_throttle_locked = !is_throttle_locked; // Toggle throttle lock if (is_throttle_locked) { display_blank_now = true; // Clear display display_second_screen = false; // Request primary screen with throttle locked + melody_play(MELODY_GPS_LOST, true); + haptic_play(MELODY_GPS_LOST, true); + } else { + display_blank_now = true; // Clear the display if we turn off throttle lock + melody_play(MELODY_GPS_LOCK, true); + haptic_play(MELODY_GPS_LOCK, true); } - else display_blank_now = true; // Clear the display if we turn off throttle lock ESP_LOGI(__FUNCTION__, "Throttle lock is %d", is_throttle_locked); } if ((ev.pin == GPIO_INPUT_IO_1) && (ev.event == BUTTON_DOWN)) { From 241eaf804ec00773917527cd19b5e9397b490df0 Mon Sep 17 00:00:00 2001 From: r3n33 Date: Tue, 7 Sep 2021 10:30:34 -0500 Subject: [PATCH 4/9] Add all melodies to haptics --- main/lib/haptic/haptic.c | 56 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/main/lib/haptic/haptic.c b/main/lib/haptic/haptic.c index 7ecec57..6a15afc 100644 --- a/main/lib/haptic/haptic.c +++ b/main/lib/haptic/haptic.c @@ -2,6 +2,8 @@ #include "../../esp-i2c.h" +#include "esp_log.h" + int haptic_notes=0; int haptic_wholenote = 0; int haptic_divider = 0; @@ -63,21 +65,71 @@ void haptic_play(int index, bool interrupt_melody) { case MELODY_GOTCHI_FAULT: haptic = (int*)&melody_gotchi_fault; - haptic_notes=sizeof(melody_gotchi_fault)/sizeof(melody_gotchi_fault[0])/2; + haptic_notes = sizeof(melody_gotchi_fault)/sizeof(melody_gotchi_fault[0])/2; haptic_wholenote = (60000 * 4) / tempo_gotchi_fault; break; + case MELODY_ESC_FAULT: + haptic = (int*)&melody_esc_fault; + haptic_notes = sizeof(melody_esc_fault)/sizeof(melody_esc_fault[0])/2; + haptic_wholenote = (60000 * 4) / tempo_esc_fault; + break; + case MELODY_BLE_FAIL: + haptic = (int*)&melody_ble_fail; + haptic_notes = sizeof(melody_ble_fail)/sizeof(melody_ble_fail[0])/2; + haptic_wholenote = (60000 * 4) / tempo_ble_fail; + break; + case MELODY_BLE_SUCCESS: + haptic = (int*)&melody_ble_success; + haptic_notes = sizeof(melody_ble_success)/sizeof(melody_ble_success[0])/2; + haptic_wholenote = (60000 * 4) / tempo_ble_success; + break; + case MELODY_STORAGE_LIMIT: + haptic = (int*)&melody_storage_limit; + haptic_notes = sizeof(melody_storage_limit)/sizeof(melody_storage_limit[0])/2; + haptic_wholenote = (60000 * 4) / tempo_storage_limit; + break; + case MELODY_ESC_TEMP: + haptic = (int*)&melody_esc_temp; + haptic_notes = sizeof(melody_esc_temp)/sizeof(melody_esc_temp[0])/2; + haptic_wholenote = (60000 * 4) / tempo_esc_temp; + break; + case MELODY_MOTOR_TEMP: + haptic = (int*)&melody_motor_temp; + haptic_notes = sizeof(melody_motor_temp)/sizeof(melody_motor_temp[0])/2; + haptic_wholenote = (60000 * 4) / tempo_motor_temp; + break; + case MELODY_VOLTAGE_LOW: + haptic = (int*)&melody_voltage_low; + haptic_notes = sizeof(melody_voltage_low)/sizeof(melody_voltage_low[0])/2; + haptic_wholenote = (60000 * 4) / tempo_voltage_low; + break; case MELODY_LOG_START: haptic = (int*)&melody_ascending; haptic_notes = sizeof(melody_ascending)/sizeof(melody_ascending[0])/2; haptic_wholenote = (60000 * 4) / tempo_ascending; break; + case MELODY_LOG_STOP: + haptic = (int*)&melody_descending; + haptic_notes = sizeof(melody_descending)/sizeof(melody_descending[0])/2; + haptic_wholenote = (60000 * 4) / tempo_descending; + break; case MELODY_STARTUP: haptic = (int*)&melody_startup; haptic_notes = sizeof(melody_startup)/sizeof(melody_startup[0])/2; haptic_wholenote = (60000 * 4) / tempo_startup; break; + case MELODY_GPS_LOCK: + haptic = (int*)&melody_gps_locked; + haptic_notes = sizeof(melody_gps_locked)/sizeof(melody_gps_locked[0])/2; + haptic_wholenote = (60000 * 4) / tempo_gps_locked; + break; + case MELODY_GPS_LOST: + haptic = (int*)&melody_gps_lost; + haptic_notes = sizeof(melody_gps_lost)/sizeof(melody_gps_lost[0])/2; + haptic_wholenote = (60000 * 4) / tempo_gps_lost; + break; default: - //TODO: add default haptic + ESP_LOGW(__FUNCTION__,"Invalid index %d", index); break; } From 31c053a93a1f680d261bd5c4eacfc4cd96ced7cd Mon Sep 17 00:00:00 2001 From: r3n33 Date: Tue, 7 Sep 2021 10:31:36 -0500 Subject: [PATCH 5/9] Output warning if invalid melody index is requested --- main/lib/melody/melody.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main/lib/melody/melody.c b/main/lib/melody/melody.c index 785ddaf..e829839 100644 --- a/main/lib/melody/melody.c +++ b/main/lib/melody/melody.c @@ -1,4 +1,5 @@ #include "melody.h" +#include "esp_log.h" #include "driver/ledc.h" int melody_notes=0; @@ -105,7 +106,6 @@ void melody_play(int index, bool interrupt_melody) melody_wholenote = (60000 * 4) / tempo_descending; break; case MELODY_STARTUP: - printf("melody startup received\n"); melody = (int*)&melody_startup; melody_notes=sizeof(melody_startup)/sizeof(melody_startup[0])/2; melody_wholenote = (60000 * 4) / tempo_startup; @@ -121,7 +121,7 @@ void melody_play(int index, bool interrupt_melody) melody_wholenote = (60000 * 4) / tempo_gps_lost; break; default: - //TODO: add default melody + ESP_LOGW(__FUNCTION__,"Invalid index %d", index); break; } @@ -145,7 +145,6 @@ void melody_step(void) melody_this_note = 0; is_melody_playing = false; ledc_stop(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL, 0); - printf("end of melody\n"); return; } From dc67db6acdd1354f097a6702be37fe657f57587e Mon Sep 17 00:00:00 2001 From: r3n33 Date: Tue, 7 Sep 2021 10:32:07 -0500 Subject: [PATCH 6/9] Change power off melody --- main/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/main.c b/main/main.c index 4b9d82e..d4c7496 100644 --- a/main/main.c +++ b/main/main.c @@ -277,8 +277,8 @@ static void gpio_input_task(void* arg) // SW2 on HW v1.2 PCB } if ((ev.pin == GPIO_INPUT_IO_3) && (ev.event == BUTTON_HELD)) { - melody_play(MELODY_GPS_LOST, true); - haptic_play(MELODY_GPS_LOST, true); + melody_play(MELODY_LOG_STOP, true); + haptic_play(MELODY_LOG_STOP, true); ESP_LOGI(__FUNCTION__, "Setting MCU_LATCH to 0"); /// Turn Power switch LED off gpio_set_level(GPIO_OUTPUT_IO_0, 0); From b16b79420db51fca029576e086459b8e463802f1 Mon Sep 17 00:00:00 2001 From: r3n33 Date: Tue, 7 Sep 2021 15:43:22 -0500 Subject: [PATCH 7/9] Update README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b150ea8..f18514a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # FreeSK8-Remote-Firmware +To compile follow steps 1-4 of the [ESP IDF Setup Instructions](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/index.html#setting-up-development-environment) to setup your development environment. + +With ESP IDF installed execute: ``` . $HOME/esp/esp-idf/export.sh ``` - +then ``` idf.py -p /dev/ttyUSB0 build flash monitor ``` From 5e67d48d2da3c638becc5a7d3d2eb2af018250ee Mon Sep 17 00:00:00 2001 From: r3n33 Date: Tue, 7 Sep 2021 15:43:31 -0500 Subject: [PATCH 8/9] Update CHANGELOG --- CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 9bf32e9..fc2df40 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +v0.1.1 + +* Reassign melodies +* Fix mising hapic melodies +* Fix efficiency value + v0.1.0 * Initial Beta From c17ae35f6b079381cb3eb1214339eafd97ad5121 Mon Sep 17 00:00:00 2001 From: r3n33 Date: Wed, 8 Sep 2021 12:32:32 -0500 Subject: [PATCH 9/9] Adjust min and max values for temp gauges --- main/display.c | 8 ++++---- main/main.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main/display.c b/main/display.c index b9280fd..101762e 100644 --- a/main/display.c +++ b/main/display.c @@ -553,10 +553,10 @@ TickType_t drawScreenSecondary(TFT_t * dev, FontxFile *fx, int width, int height { temp_mos_previous = esc_telemetry.temp_mos; if (user_settings->dispaly_fahrenheit) { - esc_temp_mapped = map(CTOF(esc_telemetry.temp_mos), 25, 100, 1, 20); + esc_temp_mapped = map(CTOF(esc_telemetry.temp_mos), CTOF(0), CTOF(100), 1, 20); display_temperature = CTOF(esc_telemetry.temp_mos); } else { - esc_temp_mapped = map(esc_telemetry.temp_mos, 25, 100, 1, 20); + esc_temp_mapped = map(esc_telemetry.temp_mos, 0, 100, 1, 20); display_temperature = esc_telemetry.temp_mos; } if (display_temperature < 0) display_temperature = 0; @@ -581,10 +581,10 @@ TickType_t drawScreenSecondary(TFT_t * dev, FontxFile *fx, int width, int height { temp_motor_previous = esc_telemetry.temp_motor; if (user_settings->dispaly_fahrenheit) { - motor_temp_mapped = map(CTOF(esc_telemetry.temp_motor), 25, 100, 1, 20); + motor_temp_mapped = map(CTOF(esc_telemetry.temp_motor), CTOF(0), CTOF(100), 1, 20); display_temperature = CTOF(esc_telemetry.temp_motor); } else { - motor_temp_mapped = map(esc_telemetry.temp_motor, 25, 100, 1, 20); + motor_temp_mapped = map(esc_telemetry.temp_motor, 0, 100, 1, 20); display_temperature = esc_telemetry.temp_motor; } if (display_temperature < 0) display_temperature = 0; diff --git a/main/main.c b/main/main.c index d4c7496..8a68aea 100644 --- a/main/main.c +++ b/main/main.c @@ -387,7 +387,7 @@ static void i2c_task(void *arg) } if (!gpio_usb_detect) { - // Check if we've been idle for more than 5 seconds + // Check if throttle has been idle for more than 5 minutes if ((xTaskGetTickCount() - startTickThrottleIdle)*portTICK_RATE_MS > 5 * 60 * 1000) { is_throttle_idle = true;