Skip to content

Commit

Permalink
if the semaphore fails here we should keep ringing (#694)
Browse files Browse the repository at this point in the history
* this one should be firmware version

* don't turn off audio if semaphore grab fails

* match timeout to ramp

* fix the build
  • Loading branch information
plasticchris authored Nov 9, 2016
1 parent cc36908 commit d60ffd8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
7 changes: 1 addition & 6 deletions kitsune/audiotask.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,12 @@ static void _change_volume_task(hlo_future_t * result, void * ctx){
LOGI("Setting volume %u at %u\n", v->current, xTaskGetTickCount());
}

if( xSemaphoreTakeRecursive(i2c_smphr, 100)) {
if( xSemaphoreTakeRecursive(i2c_smphr, 10)) {
//set vol
vTaskDelay(5);
set_volume(v->current, 0);
vTaskDelay(5);
xSemaphoreGiveRecursive(i2c_smphr);

}else{
//set volume failed, instantly exit out of this async worker.
AudioTask_StopPlayback();
hlo_future_write(result, NULL, 0, -1);
}
}
AudioTask_StopPlayback();
Expand Down
4 changes: 2 additions & 2 deletions kitsune/hlo_proto_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ static void encode_MorpheusCommand(hlo_future_t * result, void * context){
goto end;
}
command->version = PROTOBUF_VERSION;
command->has_protocol_version = true;
command->protocol_version = FIRMWARE_VERSION_INTERNAL;
command->has_firmware_version = true;
command->firmware_version = FIRMWARE_VERSION_INTERNAL;

ble_proto_assign_encode_funcs(command);

Expand Down
4 changes: 2 additions & 2 deletions kitsune/protobuf/morpheus_ble.pb.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const pb_field_t MorpheusCommand_fields[23] = {
PB_FIELD( 6, STRING , OPTIONAL, CALLBACK, OTHER, MorpheusCommand, wifiName, error, 0),
PB_FIELD( 7, STRING , OPTIONAL, CALLBACK, OTHER, MorpheusCommand, wifiSSID, wifiName, 0),
PB_FIELD( 8, STRING , OPTIONAL, CALLBACK, OTHER, MorpheusCommand, wifiPassword, wifiSSID, 0),
PB_FIELD( 13, INT32 , OPTIONAL, STATIC , OTHER, MorpheusCommand, protocol_version, wifiPassword, 0),
PB_FIELD( 14, MESSAGE , REPEATED, CALLBACK, OTHER, MorpheusCommand, wifi_scan_result, protocol_version, &wifi_endpoint_fields),
PB_FIELD( 13, INT32 , OPTIONAL, STATIC , OTHER, MorpheusCommand, firmware_version, wifiPassword, 0),
PB_FIELD( 14, MESSAGE , REPEATED, CALLBACK, OTHER, MorpheusCommand, wifi_scan_result, firmware_version, &wifi_endpoint_fields),
PB_FIELD( 15, ENUM , OPTIONAL, STATIC , OTHER, MorpheusCommand, security_type, wifi_scan_result, 0),
PB_FIELD( 16, MESSAGE , OPTIONAL, STATIC , OTHER, MorpheusCommand, pill_data, security_type, &pill_data_fields),
PB_FIELD( 17, ENUM , OPTIONAL, STATIC , OTHER, MorpheusCommand, wifi_connection_state, pill_data, 0),
Expand Down
4 changes: 2 additions & 2 deletions kitsune/protobuf/morpheus_ble.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ typedef struct _MorpheusCommand {
pb_callback_t wifiName;
pb_callback_t wifiSSID;
pb_callback_t wifiPassword;
bool has_protocol_version;
int32_t protocol_version;
bool has_firmware_version;
int32_t firmware_version;
pb_callback_t wifi_scan_result;
bool has_security_type;
wifi_endpoint_sec_type security_type;
Expand Down

0 comments on commit d60ffd8

Please sign in to comment.