mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
mesh: add mesh_access_time_as_gdtt, store step_duration_ms in uint32_t
This commit is contained in:
parent
618a5fc3d1
commit
d975617d67
@ -301,6 +301,29 @@ uint32_t mesh_access_time_gdtt2ms(uint8_t time_gdtt){
|
||||
return mesh_access_transitions_step_ms_from_gdtt(time_gdtt) * num_steps;
|
||||
}
|
||||
|
||||
uint8_t mesh_access_time_as_gdtt(uint32_t step_resolution_ms, uint32_t time_ms){
|
||||
uint8_t resolution;
|
||||
switch (step_resolution_ms){
|
||||
case 100:
|
||||
resolution = MESH_DEFAULT_TRANSITION_STEP_RESOLUTION_100ms;
|
||||
break;
|
||||
case 1000:
|
||||
resolution = MESH_DEFAULT_TRANSITION_STEP_RESOLUTION_1s;
|
||||
break;
|
||||
case 10000:
|
||||
resolution = MESH_DEFAULT_TRANSITION_STEP_RESOLUTION_10s;
|
||||
break;
|
||||
case 600000:
|
||||
resolution = MESH_DEFAULT_TRANSITION_STEP_RESOLUTION_10min;
|
||||
break;
|
||||
default:
|
||||
resolution = MESH_DEFAULT_TRANSITION_STEP_RESOLUTION_100ms;
|
||||
break;
|
||||
}
|
||||
uint8_t num_steps = time_ms / step_resolution_ms;
|
||||
return (resolution << 6) | num_steps;
|
||||
}
|
||||
|
||||
static void mesh_access_transitions_timeout_handler(btstack_timer_source_t * timer){
|
||||
btstack_linked_list_iterator_t it;
|
||||
btstack_linked_list_iterator_init(&it, &transitions);
|
||||
|
@ -134,10 +134,10 @@ typedef struct mesh_transition {
|
||||
uint16_t src_address;
|
||||
uint16_t dst_address;
|
||||
|
||||
mesh_default_transition_step_resolution_t step_duration_ms;
|
||||
uint32_t step_duration_ms;
|
||||
uint32_t phase_start_ms;
|
||||
uint32_t remaining_delay_time_ms;
|
||||
uint32_t remaining_transition_time_ms;
|
||||
uint32_t remaining_delay_time_ms;
|
||||
uint32_t remaining_transition_time_ms;
|
||||
// to send events and/or publish changes
|
||||
mesh_model_t * mesh_model;
|
||||
|
||||
@ -182,6 +182,7 @@ void mesh_access_send_acknowledged_pdu(mesh_pdu_t * pdu, uint8_t retransmissions
|
||||
|
||||
uint8_t mesh_access_transitions_num_steps_from_gdtt(uint8_t time_gdtt);
|
||||
uint32_t mesh_access_time_gdtt2ms(uint8_t time_gdtt);
|
||||
uint8_t mesh_access_time_as_gdtt(uint32_t step_resolution_ms, uint32_t time_ms);
|
||||
|
||||
void mesh_access_emit_state_update_bool(btstack_packet_handler_t event_handler, uint8_t element_index, uint32_t model_identifier,
|
||||
model_state_id_t state_identifier, model_state_update_reason_t reason, uint8_t value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user