FSM2: rm rtm code, change print, add ldr_schwelle

This commit is contained in:
Simon Schmidt 2021-07-03 17:36:10 +02:00
parent eeac10c66f
commit f5d6e376c6
4 changed files with 10 additions and 33 deletions

@ -1 +1 @@
Subproject commit 23e06c06a6026801a856141f64a6de54dd493b47
Subproject commit a70be39257e317d35e9118b385006a1e030e6452

View File

@ -17,7 +17,6 @@
// Validation result: Not run
//
#include "FSMTreppe2.h"
// #include "FSMTreppe_private.h"
#include <stdint.h>
// Named constants for Chart: '<Root>/FSMTreppe'
@ -212,8 +211,7 @@ void FSMTreppeModelClass::terminate()
FSMTreppeModelClass::FSMTreppeModelClass() :
FSMTreppe_DW(),
FSMTreppe_U(),
FSMTreppe_Y(),
FSMTreppe_M()
FSMTreppe_Y()
{
// Currently there is no constructor body generated.
}
@ -224,12 +222,6 @@ FSMTreppeModelClass::~FSMTreppeModelClass()
// Currently there is no destructor body generated.
}
// Real-Time Model get method
FSMTreppeModelClass::RT_MODEL_FSMTreppe_T * FSMTreppeModelClass::getRTM()
{
return (&FSMTreppe_M);
}
//
// File trailer for generated code.
//

View File

@ -21,15 +21,6 @@
#include <stdint.h>
// Macros for accessing real-time model data structure
#ifndef rtmGetErrorStatus
#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef rtmSetErrorStatus
#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
#endif
// Class declaration for model FSMTreppe
class FSMTreppeModelClass {
// public data and function members
@ -56,11 +47,6 @@ class FSMTreppeModelClass {
uint8_t dimmrichtung; // '<Root>/dimmrichtung'
};
// Real-time Model Data Structure
struct RT_MODEL_FSMTreppe_T {
const char * volatile errorStatus;
};
// model initialize function
void initialize();
@ -92,9 +78,6 @@ class FSMTreppeModelClass {
return FSMTreppe_Y;
}
// Real-Time Model get method
FSMTreppeModelClass::RT_MODEL_FSMTreppe_T * getRTM();
// private data and function members
private:
// Block states
@ -105,9 +88,6 @@ class FSMTreppeModelClass {
// External outputs
ExtY_FSMTreppe_T FSMTreppe_Y;
// Real-Time Model
RT_MODEL_FSMTreppe_T FSMTreppe_M;
};
//-

View File

@ -160,16 +160,20 @@ void Treppe::print_state_on_change() {
if(
fsm_inputs.anim_beendet != last_in.anim_beendet ||
fsm_inputs.sensor_oben != last_in.sensor_oben ||
fsm_inputs.sensor_unten != last_in.sensor_unten
fsm_inputs.sensor_unten != last_in.sensor_unten ||
fsm_outputs.dimmrichtung != last_out.dimmrichtung ||
fsm_outputs.laufrichtung != last_out.laufrichtung ||
fsm_outputs.status != last_out.status
) {
last_in.anim_beendet = fsm_inputs.anim_beendet;
last_in.sensor_oben = fsm_inputs.sensor_oben;
last_in.sensor_unten = fsm_inputs.sensor_unten;
Serial.printf("FSM inputs: s_u: %d, s_o: %d, an_fin: %d =>",
Serial.printf("FSM IN: s_u: %d, s_o: %d, beendet: %d =>",
fsm_inputs.sensor_oben, fsm_inputs.sensor_unten, fsm_inputs.anim_beendet);
Serial.print(" step => ");
Serial.printf("FSM outputs: LR: %d DR: %d ST: %d\n", fsm_outputs.laufrichtung, fsm_outputs.dimmrichtung, fsm_outputs.status);
Serial.printf("OUT: LR: %d DR: %d ST: %d\n",
fsm_outputs.laufrichtung, fsm_outputs.dimmrichtung, fsm_outputs.status);
}
}
@ -181,6 +185,7 @@ void Treppe::task(){
state = switch_state;
}
fsm_inputs.ldr_schwelle = 1;
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
fsm_inputs.anim_beendet = static_cast<bool>(finish);