Browse Source

FSM2: rm rtm code, change print, add ldr_schwelle

tags/FSM2.0
Simon Schmidt 3 years ago
parent
commit
f5d6e376c6

+ 1
- 1
lib/PCA9685-Arduino

Subproject commit 23e06c06a6026801a856141f64a6de54dd493b47
Subproject commit a70be39257e317d35e9118b385006a1e030e6452

+ 1
- 9
lib/treppe/FSMTreppe2/FSMTreppe2.cpp View File

// Validation result: Not run // Validation result: Not run
// //
#include "FSMTreppe2.h" #include "FSMTreppe2.h"
// #include "FSMTreppe_private.h"
#include <stdint.h> #include <stdint.h>


// Named constants for Chart: '<Root>/FSMTreppe' // Named constants for Chart: '<Root>/FSMTreppe'
FSMTreppeModelClass::FSMTreppeModelClass() : FSMTreppeModelClass::FSMTreppeModelClass() :
FSMTreppe_DW(), FSMTreppe_DW(),
FSMTreppe_U(), FSMTreppe_U(),
FSMTreppe_Y(),
FSMTreppe_M()
FSMTreppe_Y()
{ {
// Currently there is no constructor body generated. // Currently there is no constructor body generated.
} }
// Currently there is no destructor body generated. // 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. // File trailer for generated code.
// //

+ 0
- 20
lib/treppe/FSMTreppe2/FSMTreppe2.h View File



#include <stdint.h> #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 declaration for model FSMTreppe
class FSMTreppeModelClass { class FSMTreppeModelClass {
// public data and function members // public data and function members
uint8_t dimmrichtung; // '<Root>/dimmrichtung' uint8_t dimmrichtung; // '<Root>/dimmrichtung'
}; };


// Real-time Model Data Structure
struct RT_MODEL_FSMTreppe_T {
const char * volatile errorStatus;
};

// model initialize function // model initialize function
void initialize(); void initialize();


return FSMTreppe_Y; return FSMTreppe_Y;
} }


// Real-Time Model get method
FSMTreppeModelClass::RT_MODEL_FSMTreppe_T * getRTM();

// private data and function members // private data and function members
private: private:
// Block states // Block states


// External outputs // External outputs
ExtY_FSMTreppe_T FSMTreppe_Y; ExtY_FSMTreppe_T FSMTreppe_Y;

// Real-Time Model
RT_MODEL_FSMTreppe_T FSMTreppe_M;
}; };


//- //-

+ 8
- 3
lib/treppe/treppe.cpp View File

if( if(
fsm_inputs.anim_beendet != last_in.anim_beendet || fsm_inputs.anim_beendet != last_in.anim_beendet ||
fsm_inputs.sensor_oben != last_in.sensor_oben || 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.anim_beendet = fsm_inputs.anim_beendet;
last_in.sensor_oben = fsm_inputs.sensor_oben; last_in.sensor_oben = fsm_inputs.sensor_oben;
last_in.sensor_unten = fsm_inputs.sensor_unten; 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); fsm_inputs.sensor_oben, fsm_inputs.sensor_unten, fsm_inputs.anim_beendet);
Serial.print(" step => "); 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);
} }
} }


state = switch_state; state = switch_state;
} }
fsm_inputs.ldr_schwelle = 1;
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN); fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN); fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
fsm_inputs.anim_beendet = static_cast<bool>(finish); fsm_inputs.anim_beendet = static_cast<bool>(finish);

Loading…
Cancel
Save