Fixed some issues
This commit is contained in:
parent
f95bcb503a
commit
69b7b1b245
|
@ -12,6 +12,7 @@
|
|||
#include "avrcp.h"
|
||||
#include "a2dp.h"
|
||||
#include "twai.h"
|
||||
#include "volume.h"
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
@ -48,4 +49,5 @@ extern "C" void app_main() {
|
|||
|
||||
/* can::init(); */
|
||||
twai::init();
|
||||
volume_controller::init();
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ void twai::change_volume(bool up) {
|
|||
buttons.volume_down = true;
|
||||
}
|
||||
|
||||
|
||||
twai_message_t message;
|
||||
memset(&message, 0, sizeof(message));
|
||||
|
||||
|
@ -71,6 +70,22 @@ void twai::change_volume(bool up) {
|
|||
message.data[2] = ((uint8_t*)&buttons)[2];
|
||||
|
||||
|
||||
for (int i = 0; i < message.data_length_code; i++) {
|
||||
ESP_LOGI(TWAI_TAG, "%i: 0x%X", i, message.data[i]);
|
||||
}
|
||||
|
||||
if (twai_transmit(&message, pdMS_TO_TICKS(1000)) == ESP_OK) {
|
||||
ESP_LOGI(TWAI_TAG, "Message queued for transmission");
|
||||
} else {
|
||||
ESP_LOGI(TWAI_TAG, "Failed tp queue message for transmission");
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(30));
|
||||
|
||||
buttons.volume_up = false;
|
||||
buttons.volume_down = false;
|
||||
message.data[0] = ((uint8_t*)&buttons)[0];
|
||||
|
||||
for (int i = 0; i < message.data_length_code; i++) {
|
||||
ESP_LOGI(TWAI_TAG, "%i: 0x%X", i, message.data[i]);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ static uint8_t remote_volume;
|
|||
// 0-30
|
||||
static uint8_t radio_volume;
|
||||
|
||||
static bool synced = false;
|
||||
static bool synced = true;
|
||||
static _lock_t lock;
|
||||
|
||||
void volume_controller::set_from_radio(int v) {
|
||||
|
@ -79,7 +79,7 @@ static void correct_volume(void*) {
|
|||
}
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
vTaskDelay(pdMS_TO_TICKS(30));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user