Compare commits

...

2 Commits

Author SHA1 Message Date
Jasper Blanckenburg 41dbfa73ee Add compile_commands.json to .gitignore 2023-03-20 15:22:12 +01:00
Jasper Blanckenburg aba6604e57 Fix warnings 2023-03-20 15:21:45 +01:00
6 changed files with 8 additions and 12 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@
/build/ /build/
/.cache/ /.cache/
.clangd .clangd
compile_commands.json
TouchGFX/build TouchGFX/build

View File

@ -27,11 +27,13 @@
/* USER CODE BEGIN Includes */ /* USER CODE BEGIN Includes */
#include "app.h" #include "app.h"
#include "main.h" #include "main.h"
#include "tx_api.h"
#include "tx_port.h"
#include "ui.h" #include "ui.h"
#include "vehicle.h" #include "vehicle.h"
#include "app_touchgfx.h"
#include "tx_api.h"
#include "tx_port.h"
/* USER CODE END Includes */ /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/

@ -1 +1 @@
Subproject commit b2929ad66414b394805ee1d2b9c4778a2f9fe515 Subproject commit 66983c30d398a41641b81a8050e11dfbcaecf6ed

View File

@ -39,7 +39,6 @@ void ui_thread_entry(ULONG _) {
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
// This gets called when an edge on one of the encoder pins is detected. // This gets called when an edge on one of the encoder pins is detected.
static uint32_t last_change[NUM_ENCS * 2] = {0};
static GPIO_PinState last_state[NUM_ENCS * 2] = {GPIO_PIN_RESET}; static GPIO_PinState last_state[NUM_ENCS * 2] = {GPIO_PIN_RESET};
if (GPIO_Pin == ENC2B_Pin) { if (GPIO_Pin == ENC2B_Pin) {
@ -48,8 +47,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
// ENC2A, we can just ignore it now. // ENC2A, we can just ignore it now.
} }
uint32_t now = HAL_GetTick();
uint16_t pin_a, pin_b; uint16_t pin_a, pin_b;
int idx_a, idx_b; int idx_a, idx_b;
ButtonMessage msg; ButtonMessage msg;
@ -79,14 +76,10 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
// Second rising edge, direction depends on which pin changed last // Second rising edge, direction depends on which pin changed last
if (a_changed && b_changed) { if (a_changed && b_changed) {
// This shouldn't happen. Ignore this event. // This shouldn't happen. Ignore this event.
last_change[idx_a] = now;
last_change[idx_b] = now;
return; return;
} else if (a_changed) { } else if (a_changed) {
last_change[idx_a] = now;
msg.kind = UMK_ENC_CCW; msg.kind = UMK_ENC_CCW;
} else if (b_changed) { } else if (b_changed) {
last_change[idx_b] = now;
msg.kind = UMK_ENC_CW; msg.kind = UMK_ENC_CW;
} else { } else {
// This shouldn't happen. Ignore this event. // This shouldn't happen. Ignore this event.

View File

@ -15,7 +15,7 @@ public:
protected: protected:
private: private:
unsigned temp; int temp;
Unicode::UnicodeChar valueBuffer[3]; Unicode::UnicodeChar valueBuffer[3];
void updateValueBuffer(); void updateValueBuffer();

View File

@ -36,7 +36,7 @@ void TireTemp::setTemp(int temp_in_celsius) {
void TireTemp::updateValueBuffer() { void TireTemp::updateValueBuffer() {
// Unicode::utoa(temp, valueBuffer, 3, 10); // Unicode::utoa(temp, valueBuffer, 3, 10);
Unicode::snprintf(valueBuffer, Unicode::snprintf(valueBuffer,
sizeof(valueBuffer) / sizeof(Unicode::UnicodeChar), "%02u", sizeof(valueBuffer) / sizeof(Unicode::UnicodeChar), "%02d",
temp); temp);
value.setWildcard(valueBuffer); value.setWildcard(valueBuffer);
} }