fix everything
This commit is contained in:
parent
e8f246cfa5
commit
675efff85c
8 changed files with 71 additions and 41 deletions
|
|
@ -68,7 +68,7 @@ static void run_cycle(Statechart* handle);
|
|||
|
||||
|
||||
|
||||
static void statechart_internal_set_speed(Statechart* handle, sc_real value)
|
||||
static void statechart_internal_set_speed(Statechart* handle, int32_t value)
|
||||
;
|
||||
static void statechart_internal_set_pid_vars(Statechart* handle, pid_vars_t value)
|
||||
;
|
||||
|
|
@ -100,11 +100,11 @@ void statechart_init(Statechart* handle)
|
|||
|
||||
clear_in_events(handle);
|
||||
|
||||
sc_observable_sc_real_init(&handle->iface.setMotorR);
|
||||
sc_observable_sc_real_init(&handle->iface.setMotorL);
|
||||
sc_observable_int32_t_init(&handle->iface.setMotorR);
|
||||
sc_observable_int32_t_init(&handle->iface.setMotorL);
|
||||
|
||||
/* Default init sequence for statechart Statechart */
|
||||
statechart_internal_set_speed(handle, 0.0);
|
||||
statechart_internal_set_speed(handle, 0);
|
||||
|
||||
handle->isExecuting = bool_false;
|
||||
statechart_eventqueue_init(&handle->in_event_queue, handle->in_buffer, STATECHART_IN_EVENTQUEUE_BUFFERSIZE);
|
||||
|
|
@ -287,7 +287,7 @@ static void run_cycle(Statechart* handle)
|
|||
}
|
||||
|
||||
|
||||
void statechart_raise_sensor(Statechart* handle, sc_real value)
|
||||
void statechart_raise_sensor(Statechart* handle, int32_t value)
|
||||
{
|
||||
statechart_add_value_event_to_queue(&(handle->in_event_queue), Statechart_sensor, &value);
|
||||
run_cycle(handle);
|
||||
|
|
@ -306,17 +306,17 @@ void statechart_raise_buttonReleased(Statechart* handle)
|
|||
}
|
||||
|
||||
|
||||
sc_observable_sc_real* statechart_get_setMotorR(Statechart* handle)
|
||||
sc_observable_int32_t* statechart_get_setMotorR(Statechart* handle)
|
||||
{
|
||||
return &handle->iface.setMotorR;
|
||||
}
|
||||
sc_observable_sc_real* statechart_get_setMotorL(Statechart* handle)
|
||||
sc_observable_int32_t* statechart_get_setMotorL(Statechart* handle)
|
||||
{
|
||||
return &handle->iface.setMotorL;
|
||||
}
|
||||
|
||||
|
||||
static void statechart_internal_set_speed(Statechart* handle, sc_real value)
|
||||
static void statechart_internal_set_speed(Statechart* handle, int32_t value)
|
||||
{
|
||||
handle->internal.speed = value;
|
||||
}
|
||||
|
|
@ -334,12 +334,12 @@ static void enact_main_region_on_r1_responding(Statechart* handle)
|
|||
/* Entry action for state 'responding'. */
|
||||
statechart_internal_set_speed(handle, statechart_pid(handle,handle->iface.sensor_value, handle->internal.pid_vars));
|
||||
{
|
||||
sc_real iface_setMotorL_value = handle->internal.speed;
|
||||
sc_observable_sc_real_next(&handle->iface.setMotorL, iface_setMotorL_value);
|
||||
int32_t iface_setMotorL_value = handle->internal.speed;
|
||||
sc_observable_int32_t_next(&handle->iface.setMotorL, iface_setMotorL_value);
|
||||
};
|
||||
{
|
||||
sc_real iface_setMotorR_value = handle->internal.speed;
|
||||
sc_observable_sc_real_next(&handle->iface.setMotorR, iface_setMotorR_value);
|
||||
int32_t iface_setMotorR_value = handle->internal.speed;
|
||||
sc_observable_int32_t_next(&handle->iface.setMotorR, iface_setMotorR_value);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -348,12 +348,12 @@ static void enact_main_region_on_r1_sensor_error(Statechart* handle)
|
|||
{
|
||||
/* Entry action for state 'sensor_error'. */
|
||||
{
|
||||
sc_real iface_setMotorL_value = 1;
|
||||
sc_observable_sc_real_next(&handle->iface.setMotorL, iface_setMotorL_value);
|
||||
int32_t iface_setMotorL_value = 1;
|
||||
sc_observable_int32_t_next(&handle->iface.setMotorL, iface_setMotorL_value);
|
||||
};
|
||||
{
|
||||
sc_real iface_setMotorR_value = -(1);
|
||||
sc_observable_sc_real_next(&handle->iface.setMotorR, iface_setMotorR_value);
|
||||
int32_t iface_setMotorR_value = -(1);
|
||||
sc_observable_int32_t_next(&handle->iface.setMotorR, iface_setMotorR_value);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -858,7 +858,7 @@ static void statechart_event_value_init(statechart_event * ev, StatechartEventID
|
|||
switch(name)
|
||||
{
|
||||
case Statechart_sensor:
|
||||
ev->value.Statechart_sensor_value = *((sc_real*)value);
|
||||
ev->value.Statechart_sensor_value = *((int32_t*)value);
|
||||
break;
|
||||
default:
|
||||
/* do nothing */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue