This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Generic Level Server Bugs

Hello, 

I'm working with Mesh SDK 3.1.0. 

I made some changes in app_level.c file. 

Could you please confirm that these changes are right?

They seem to work fine, but I would appreciate very much your comments/corrections!

1) g_transition_complete(), line 368

ORIGINAL CODE: return (p_server->state.transition_type != TRANSITION_MOVE_SET && TRANSITION_TIME_COMPLETE(p_server));

MY CORRECTION: return (p_server->state.transition_type != TRANSITION_NONE && TRANSITION_TIME_COMPLETE(p_server));

Otherwise the "move" transition is infinite.

2)  generic_level_state_move_set_cb(), line 555

ORIGINAL CODE: if (p_in_transition->transition_time_ms > TRANSITION_TIME_STEP_100MS_MAX)

MY CORRECTION: if (p_in_transition->transition_time_ms > TRANSITION_TIME_MAX_MS)

3) a_transition_start(), line 257

Before assigning the "required move" to abs_delta, I calculate the target level. Otherwise, it is always 32768.

ORIGINAL CODE:

if (p_server->state.transition_type == TRANSITION_MOVE_SET)
{
abs_delta = abs(p_server->state.params.move.required_move);
}

MY CHANGE:

if (p_server->state.transition_type == TRANSITION_MOVE_SET) {
       target = (int64_t)p_server->state.present_level + (int64_t)p_server->state.params.move.required_move;      
       if (target > INT16_MAX) {
           target = INT16_MAX;
       } else if (target < INT16_MIN) {
           target = INT16_MIN;
       }
       p_server->state.target_level = target; 
       abs_delta = abs(p_server->state.params.move.required_move);
}

4) In models\model_spec\generic_ponoff\include\generic_ponoff_messages.h

Line 54

The  PONOFF opcode definitions seem to be wrong. 

Thank you very much in advance,

David 

Parents Reply Children
No Data
Related