der linker dieser sack, double declatartion of FSM, FSM3.0 implemented !
This commit is contained in:
parent
f677f18681
commit
d55da4e6d7
7
doku.md
7
doku.md
@ -97,3 +97,10 @@ new easier script needed to just convert to .gz
|
|||||||
maybe measure timings on ESP
|
maybe measure timings on ESP
|
||||||
|
|
||||||
__=> use serveStatic because way simpler !__
|
__=> use serveStatic because way simpler !__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARHRRHRGH
|
||||||
|
Two implementations of FSM are not that good,
|
||||||
|
linker puts them together ?!?
|
||||||
|
:):):):):):):)
|
@ -1,237 +0,0 @@
|
|||||||
//
|
|
||||||
// Academic License - for use in teaching, academic research, and meeting
|
|
||||||
// course requirements at degree granting institutions only. Not for
|
|
||||||
// government, commercial, or other organizational use.
|
|
||||||
//
|
|
||||||
// File: FSMTreppe.cpp
|
|
||||||
//
|
|
||||||
// Code generated for Simulink model 'FSMTreppe'.
|
|
||||||
//
|
|
||||||
// Model version : 1.29
|
|
||||||
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
|
||||||
// C/C++ source code generated on : Sat Jul 3 17:39:25 2021
|
|
||||||
//
|
|
||||||
// Target selection: ert.tlc
|
|
||||||
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
|
||||||
// Code generation objectives: Unspecified
|
|
||||||
// Validation result: Not run
|
|
||||||
//
|
|
||||||
#include "FSMTreppe2.h"
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// Named constants for Chart: '<Root>/FSMTreppe'
|
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_hoch = 1U;
|
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_runter = 2U;
|
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_hoch = 3U;
|
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_runter = 4U;
|
|
||||||
const uint8_t FSMTreppe_IN_inaktiv = 5U;
|
|
||||||
const uint8_t FSMTreppe_IN_ruhezustand = 6U;
|
|
||||||
const uint8_t FSMTreppe_IN_warten_hoch = 7U;
|
|
||||||
const uint8_t FSMTreppe_IN_warten_runter = 8U;
|
|
||||||
|
|
||||||
// Model step function
|
|
||||||
void FSMTreppeModelClass::step()
|
|
||||||
{
|
|
||||||
// Chart: '<Root>/FSMTreppe' incorporates:
|
|
||||||
// Inport: '<Root>/anim_beendet'
|
|
||||||
// Inport: '<Root>/ldr_schwelle'
|
|
||||||
// Inport: '<Root>/sensor_oben'
|
|
||||||
// Inport: '<Root>/sensor_unten'
|
|
||||||
|
|
||||||
if (FSMTreppe_DW.temporalCounter_i1 < 511U) {
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = static_cast<uint16_t>
|
|
||||||
(FSMTreppe_DW.temporalCounter_i1 + 1U);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FSMTreppe_DW.is_active_c3_FSMTreppe == 0U) {
|
|
||||||
FSMTreppe_DW.is_active_c3_FSMTreppe = 1U;
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 0U;
|
|
||||||
} else {
|
|
||||||
switch (FSMTreppe_DW.is_c3_FSMTreppe) {
|
|
||||||
case FSMTreppe_IN_abdimmen_hoch:
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 4U;
|
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
|
||||||
{
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 1U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FSMTreppe_IN_abdimmen_runter:
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 7U;
|
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
|
||||||
{
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 1U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FSMTreppe_IN_aufdimmen_hoch:
|
|
||||||
// Outport: '<Root>/laufrichtung'
|
|
||||||
FSMTreppe_Y.laufrichtung = 1U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 2U;
|
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
|
||||||
{
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_hoch;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 3U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FSMTreppe_IN_aufdimmen_runter:
|
|
||||||
// Outport: '<Root>/laufrichtung'
|
|
||||||
FSMTreppe_Y.laufrichtung = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 5U;
|
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
|
||||||
{
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_runter;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 6U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FSMTreppe_IN_inaktiv:
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 0U;
|
|
||||||
if (FSMTreppe_U.ldr_schwelle) {
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 1U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FSMTreppe_IN_ruhezustand:
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 1U;
|
|
||||||
if (FSMTreppe_U.sensor_unten) {
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_hoch;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/laufrichtung'
|
|
||||||
FSMTreppe_Y.laufrichtung = 1U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 2U;
|
|
||||||
} else if (FSMTreppe_U.sensor_oben) {
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_runter;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/laufrichtung'
|
|
||||||
FSMTreppe_Y.laufrichtung = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 5U;
|
|
||||||
} else if (!FSMTreppe_U.ldr_schwelle) {
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 0U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FSMTreppe_IN_warten_hoch:
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 3U;
|
|
||||||
if (FSMTreppe_U.sensor_oben || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
|
||||||
{
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_hoch;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 4U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
// case IN_warten_runter:
|
|
||||||
FSMTreppe_Y.status = 6U;
|
|
||||||
if (FSMTreppe_U.sensor_unten || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
|
||||||
{
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_runter;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 7U;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of Chart: '<Root>/FSMTreppe'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Model initialize function
|
|
||||||
void FSMTreppeModelClass::initialize()
|
|
||||||
{
|
|
||||||
// (no initialization code required)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Model terminate function
|
|
||||||
void FSMTreppeModelClass::terminate()
|
|
||||||
{
|
|
||||||
// (no terminate code required)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
FSMTreppeModelClass::FSMTreppeModelClass() :
|
|
||||||
FSMTreppe_DW(),
|
|
||||||
FSMTreppe_U(),
|
|
||||||
FSMTreppe_Y()
|
|
||||||
{
|
|
||||||
// Currently there is no constructor body generated.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
FSMTreppeModelClass::~FSMTreppeModelClass()
|
|
||||||
{
|
|
||||||
// Currently there is no destructor body generated.
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// File trailer for generated code.
|
|
||||||
//
|
|
||||||
// [EOF]
|
|
||||||
//
|
|
@ -1,119 +0,0 @@
|
|||||||
//
|
|
||||||
// Academic License - for use in teaching, academic research, and meeting
|
|
||||||
// course requirements at degree granting institutions only. Not for
|
|
||||||
// government, commercial, or other organizational use.
|
|
||||||
//
|
|
||||||
// File: FSMTreppe.h
|
|
||||||
//
|
|
||||||
// Code generated for Simulink model 'FSMTreppe'.
|
|
||||||
//
|
|
||||||
// Model version : 1.28
|
|
||||||
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
|
||||||
// C/C++ source code generated on : Sat Jul 3 13:50:17 2021
|
|
||||||
//
|
|
||||||
// Target selection: ert.tlc
|
|
||||||
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
|
||||||
// Code generation objectives: Unspecified
|
|
||||||
// Validation result: Not run
|
|
||||||
//
|
|
||||||
#ifndef RTW_HEADER_FSMTreppe_h_
|
|
||||||
#define RTW_HEADER_FSMTreppe_h_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// Class declaration for model FSMTreppe
|
|
||||||
class FSMTreppeModelClass {
|
|
||||||
// public data and function members
|
|
||||||
public:
|
|
||||||
// Block states (default storage) for system '<Root>'
|
|
||||||
struct DW_FSMTreppe_T {
|
|
||||||
uint16_t temporalCounter_i1; // '<Root>/FSMTreppe'
|
|
||||||
uint8_t is_active_c3_FSMTreppe; // '<Root>/FSMTreppe'
|
|
||||||
uint8_t is_c3_FSMTreppe; // '<Root>/FSMTreppe'
|
|
||||||
};
|
|
||||||
|
|
||||||
// External inputs (root inport signals with default storage)
|
|
||||||
struct ExtU_FSMTreppe_T {
|
|
||||||
bool sensor_unten; // '<Root>/sensor_unten'
|
|
||||||
bool sensor_oben; // '<Root>/sensor_oben'
|
|
||||||
bool anim_beendet; // '<Root>/anim_beendet'
|
|
||||||
bool ldr_schwelle; // '<Root>/ldr_schwelle'
|
|
||||||
};
|
|
||||||
|
|
||||||
// External outputs (root outports fed by signals with default storage)
|
|
||||||
struct ExtY_FSMTreppe_T {
|
|
||||||
uint8_t laufrichtung; // '<Root>/laufrichtung'
|
|
||||||
uint8_t status; // '<Root>/status'
|
|
||||||
uint8_t dimmrichtung; // '<Root>/dimmrichtung'
|
|
||||||
};
|
|
||||||
|
|
||||||
// model initialize function
|
|
||||||
void initialize();
|
|
||||||
|
|
||||||
// model step function
|
|
||||||
void step();
|
|
||||||
|
|
||||||
// model terminate function
|
|
||||||
void terminate();
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
FSMTreppeModelClass();
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~FSMTreppeModelClass();
|
|
||||||
|
|
||||||
// Root-level structure-based inputs set method
|
|
||||||
|
|
||||||
// Root inports set method
|
|
||||||
void setExternalInputs(const ExtU_FSMTreppe_T* pExtU_FSMTreppe_T)
|
|
||||||
{
|
|
||||||
FSMTreppe_U = *pExtU_FSMTreppe_T;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Root-level structure-based outputs get method
|
|
||||||
|
|
||||||
// Root outports get method
|
|
||||||
const FSMTreppeModelClass::ExtY_FSMTreppe_T & getExternalOutputs() const
|
|
||||||
{
|
|
||||||
return FSMTreppe_Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private data and function members
|
|
||||||
private:
|
|
||||||
// Block states
|
|
||||||
DW_FSMTreppe_T FSMTreppe_DW;
|
|
||||||
|
|
||||||
// External inputs
|
|
||||||
ExtU_FSMTreppe_T FSMTreppe_U;
|
|
||||||
|
|
||||||
// External outputs
|
|
||||||
ExtY_FSMTreppe_T FSMTreppe_Y;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-
|
|
||||||
// The generated code includes comments that allow you to trace directly
|
|
||||||
// back to the appropriate location in the model. The basic format
|
|
||||||
// is <system>/block_name, where system is the system number (uniquely
|
|
||||||
// assigned by Simulink) and block_name is the name of the block.
|
|
||||||
//
|
|
||||||
// Note that this particular code originates from a subsystem build,
|
|
||||||
// and has its own system numbers different from the parent model.
|
|
||||||
// Refer to the system hierarchy for this subsystem below, and use the
|
|
||||||
// MATLAB hilite_system command to trace the generated code back
|
|
||||||
// to the parent model. For example,
|
|
||||||
//
|
|
||||||
// hilite_system('FSM_Treppenlicht/FSMTreppe') - opens subsystem FSM_Treppenlicht/FSMTreppe
|
|
||||||
// hilite_system('FSM_Treppenlicht/FSMTreppe/Kp') - opens and selects block Kp
|
|
||||||
//
|
|
||||||
// Here is the system hierarchy for this model
|
|
||||||
//
|
|
||||||
// '<Root>' : 'FSM_Treppenlicht'
|
|
||||||
// '<S1>' : 'FSM_Treppenlicht/FSMTreppe'
|
|
||||||
|
|
||||||
#endif // RTW_HEADER_FSMTreppe_h_
|
|
||||||
|
|
||||||
//
|
|
||||||
// File trailer for generated code.
|
|
||||||
//
|
|
||||||
// [EOF]
|
|
||||||
//
|
|
@ -7,9 +7,9 @@
|
|||||||
//
|
//
|
||||||
// Code generated for Simulink model 'FSMTreppe'.
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
//
|
//
|
||||||
// Model version : 1.49
|
// Model version : 1.51
|
||||||
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
// C/C++ source code generated on : Wed Jul 7 15:27:06 2021
|
// C/C++ source code generated on : Wed Jul 7 18:54:01 2021
|
||||||
//
|
//
|
||||||
// Target selection: ert.tlc
|
// Target selection: ert.tlc
|
||||||
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||||
@ -19,16 +19,16 @@
|
|||||||
#include "FSMTreppe3.h"
|
#include "FSMTreppe3.h"
|
||||||
|
|
||||||
// Named constants for Chart: '<Root>/FSMTreppe'
|
// Named constants for Chart: '<Root>/FSMTreppe'
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_hoch = 1U;
|
const uint32_t FSMTreppe_IN_abdimmen_hoch = 1U;
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_ldr = 2U;
|
const uint32_t FSMTreppe_IN_abdimmen_ldr = 2U;
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_runter = 3U;
|
const uint32_t FSMTreppe_IN_abdimmen_runter = 3U;
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_hoch = 4U;
|
const uint32_t FSMTreppe_IN_aufdimmen_hoch = 4U;
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_ldr = 5U;
|
const uint32_t FSMTreppe_IN_aufdimmen_ldr = 5U;
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_runter = 6U;
|
const uint32_t FSMTreppe_IN_aufdimmen_runter = 6U;
|
||||||
const uint8_t FSMTreppe_IN_inaktiv = 7U;
|
const uint32_t FSMTreppe_IN_inaktiv = 7U;
|
||||||
const uint8_t FSMTreppe_IN_ruhezustand = 8U;
|
const uint32_t FSMTreppe_IN_ruhezustand = 8U;
|
||||||
const uint8_t FSMTreppe_IN_warten_hoch = 9U;
|
const uint32_t FSMTreppe_IN_warten_hoch = 9U;
|
||||||
const uint8_t FSMTreppe_IN_warten_runter = 10U;
|
const uint32_t FSMTreppe_IN_warten_runter = 10U;
|
||||||
|
|
||||||
// Model step function
|
// Model step function
|
||||||
void FSMTreppeModelClass::step()
|
void FSMTreppeModelClass::step()
|
||||||
@ -168,16 +168,7 @@ void FSMTreppeModelClass::step()
|
|||||||
case FSMTreppe_IN_ruhezustand:
|
case FSMTreppe_IN_ruhezustand:
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 3U;
|
FSMTreppe_Y.status = 3U;
|
||||||
if (FSMTreppe_U.ldr_schwelle == 0U) {
|
if (FSMTreppe_U.sensor_unten == 1U) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_ldr;
|
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
|
||||||
FSMTreppe_Y.status = 2U;
|
|
||||||
|
|
||||||
// Outport: '<Root>/dimmrichtung'
|
|
||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
|
||||||
} else if (FSMTreppe_U.sensor_unten == 1U) {
|
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_hoch;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_hoch;
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
@ -201,6 +192,15 @@ void FSMTreppeModelClass::step()
|
|||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 7U;
|
FSMTreppe_Y.status = 7U;
|
||||||
|
} else if (FSMTreppe_U.ldr_schwelle == 0U) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_ldr;
|
||||||
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 2U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
//
|
//
|
||||||
// Code generated for Simulink model 'FSMTreppe'.
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
//
|
//
|
||||||
// Model version : 1.49
|
// Model version : 1.51
|
||||||
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
// C/C++ source code generated on : Wed Jul 7 15:27:06 2021
|
// C/C++ source code generated on : Wed Jul 7 18:54:01 2021
|
||||||
//
|
//
|
||||||
// Target selection: ert.tlc
|
// Target selection: ert.tlc
|
||||||
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||||
@ -27,24 +27,24 @@ class FSMTreppeModelClass {
|
|||||||
public:
|
public:
|
||||||
// Block states (default storage) for system '<Root>'
|
// Block states (default storage) for system '<Root>'
|
||||||
struct DW_FSMTreppe_T {
|
struct DW_FSMTreppe_T {
|
||||||
uint16_t temporalCounter_i1; // '<Root>/FSMTreppe'
|
uint16_t temporalCounter_i1=0; // '<Root>/FSMTreppe'
|
||||||
uint8_t is_active_c3_FSMTreppe; // '<Root>/FSMTreppe'
|
uint8_t is_active_c3_FSMTreppe=0; // '<Root>/FSMTreppe'
|
||||||
uint8_t is_c3_FSMTreppe; // '<Root>/FSMTreppe'
|
uint8_t is_c3_FSMTreppe=0; // '<Root>/FSMTreppe'
|
||||||
};
|
};
|
||||||
|
|
||||||
// External inputs (root inport signals with default storage)
|
// External inputs (root inport signals with default storage)
|
||||||
struct ExtU_FSMTreppe_T {
|
struct ExtU_FSMTreppe_T {
|
||||||
uint32_t sensor_unten; // '<Root>/sensor_unten'
|
uint32_t sensor_unten=0; // '<Root>/sensor_unten'
|
||||||
uint32_t sensor_oben; // '<Root>/sensor_oben'
|
uint32_t sensor_oben=0; // '<Root>/sensor_oben'
|
||||||
uint32_t anim_beendet; // '<Root>/anim_beendet'
|
uint32_t anim_beendet=0; // '<Root>/anim_beendet'
|
||||||
uint32_t ldr_schwelle; // '<Root>/ldr_schwelle'
|
uint32_t ldr_schwelle=0; // '<Root>/ldr_schwelle'
|
||||||
};
|
};
|
||||||
|
|
||||||
// External outputs (root outports fed by signals with default storage)
|
// External outputs (root outports fed by signals with default storage)
|
||||||
struct ExtY_FSMTreppe_T {
|
struct ExtY_FSMTreppe_T {
|
||||||
uint32_t laufrichtung; // '<Root>/laufrichtung'
|
uint32_t laufrichtung=0; // '<Root>/laufrichtung'
|
||||||
uint32_t status; // '<Root>/status'
|
uint32_t status=0; // '<Root>/status'
|
||||||
uint32_t dimmrichtung; // '<Root>/dimmrichtung'
|
uint32_t dimmrichtung=0; // '<Root>/dimmrichtung'
|
||||||
};
|
};
|
||||||
|
|
||||||
// model initialize function
|
// model initialize function
|
||||||
@ -67,13 +67,16 @@ class FSMTreppeModelClass {
|
|||||||
// Root inports set method
|
// Root inports set method
|
||||||
void setExternalInputs(const ExtU_FSMTreppe_T* pExtU_FSMTreppe_T)
|
void setExternalInputs(const ExtU_FSMTreppe_T* pExtU_FSMTreppe_T)
|
||||||
{
|
{
|
||||||
FSMTreppe_U = *pExtU_FSMTreppe_T;
|
FSMTreppe_U.anim_beendet = pExtU_FSMTreppe_T->anim_beendet;
|
||||||
|
FSMTreppe_U.ldr_schwelle = pExtU_FSMTreppe_T->ldr_schwelle;
|
||||||
|
FSMTreppe_U.sensor_oben = pExtU_FSMTreppe_T->sensor_oben;
|
||||||
|
FSMTreppe_U.sensor_unten = pExtU_FSMTreppe_T->sensor_unten;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Root-level structure-based outputs get method
|
// Root-level structure-based outputs get method
|
||||||
|
|
||||||
// Root outports get method
|
// Root outports get method
|
||||||
const FSMTreppeModelClass::ExtY_FSMTreppe_T & getExternalOutputs() const
|
const FSMTreppeModelClass::ExtY_FSMTreppe_T getExternalOutputs() const
|
||||||
{
|
{
|
||||||
return FSMTreppe_Y;
|
return FSMTreppe_Y;
|
||||||
}
|
}
|
||||||
@ -88,7 +91,6 @@ class FSMTreppeModelClass {
|
|||||||
|
|
||||||
// External outputs
|
// External outputs
|
||||||
ExtY_FSMTreppe_T FSMTreppe_Y;
|
ExtY_FSMTreppe_T FSMTreppe_Y;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-
|
//-
|
||||||
|
@ -214,21 +214,17 @@ bool Treppe::check_ldr()
|
|||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
void Treppe::task()
|
void Treppe::task()
|
||||||
{
|
{
|
||||||
i = !i;
|
// fsm_inputs.ldr_schwelle = 1UL;
|
||||||
fsm_inputs.ldr_schwelle = i;
|
// fsm_inputs.sensor_oben = 0UL;
|
||||||
|
// fsm_inputs.sensor_unten = 0UL;
|
||||||
|
// fsm_inputs.anim_beendet = anim_beendet;
|
||||||
|
|
||||||
fsm_inputs.sensor_oben = 0UL;
|
fsm_inputs.ldr_schwelle = check_ldr();
|
||||||
fsm_inputs.sensor_unten = 0UL;
|
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
|
||||||
fsm_inputs.anim_beendet = 1UL;
|
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
|
||||||
|
fsm_inputs.anim_beendet = static_cast<bool>(anim_beendet);
|
||||||
// fsm_inputs.ldr_schwelle = check_ldr();
|
|
||||||
// fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
|
|
||||||
// fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
|
|
||||||
// fsm_inputs.anim_beendet = static_cast<bool>(anim_beendet);
|
|
||||||
|
|
||||||
FSMTreppe_Obj.setExternalInputs(&fsm_inputs);
|
FSMTreppe_Obj.setExternalInputs(&fsm_inputs);
|
||||||
FSMTreppe_Obj.step();
|
FSMTreppe_Obj.step();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef __TREPPE_H
|
#ifndef __TREPPE_H
|
||||||
#define __TREPPE_H
|
#define __TREPPE_H
|
||||||
|
|
||||||
#include "FSMTreppe2/FSMTreppe2.h"
|
#include "FSMTreppe3/FSMTreppe3.h"
|
||||||
#include "PCA9685.h"
|
#include "PCA9685.h"
|
||||||
|
|
||||||
// #define LDRDEBUG // comment in to override LDR measurement
|
// #define LDRDEBUG // comment in to override LDR measurement
|
||||||
@ -39,27 +39,16 @@ private:
|
|||||||
FSMTreppeModelClass::ExtU_FSMTreppe_T fsm_inputs;
|
FSMTreppeModelClass::ExtU_FSMTreppe_T fsm_inputs;
|
||||||
FSMTreppeModelClass::ExtY_FSMTreppe_T fsm_outputs;
|
FSMTreppeModelClass::ExtY_FSMTreppe_T fsm_outputs;
|
||||||
enum fsm_status_t {
|
enum fsm_status_t {
|
||||||
// 2.0
|
|
||||||
ST_INAKTIV_LDR =0,
|
ST_INAKTIV_LDR =0,
|
||||||
ST_RUHEZUSTAND =1,
|
ST_AUFDIMMEN_LDR =1,
|
||||||
ST_AUFDIMMEN_HOCH =2,
|
ST_ABDIMMEN_LDR =2,
|
||||||
ST_WARTEN_HOCH =3,
|
ST_RUHEZUSTAND =3,
|
||||||
ST_ABDIMMEN_HOCH =4,
|
ST_AUFDIMMEN_HOCH =4,
|
||||||
ST_AUFDIMMEN_RUNTER =5,
|
ST_WARTEN_HOCH =5,
|
||||||
ST_WARTEN_RUNTER =6,
|
ST_ABDIMMEN_HOCH =6,
|
||||||
ST_ABDIMMEN_RUNTER =7
|
ST_AUFDIMMEN_RUNTER =7,
|
||||||
|
ST_WARTEN_RUNTER =8,
|
||||||
// 3.0
|
ST_ABDIMMEN_RUNTER =9
|
||||||
// ST_INAKTIV_LDR =0,
|
|
||||||
// ST_AUFDIMMEN_LDR =1,
|
|
||||||
// ST_ABDIMMEN_LDR =2,
|
|
||||||
// ST_RUHEZUSTAND =3,
|
|
||||||
// ST_AUFDIMMEN_HOCH =4,
|
|
||||||
// ST_WARTEN_HOCH =5,
|
|
||||||
// ST_ABDIMMEN_HOCH =6,
|
|
||||||
// ST_AUFDIMMEN_RUNTER =7,
|
|
||||||
// ST_WARTEN_RUNTER =8,
|
|
||||||
// ST_ABDIMMEN_RUNTER =9
|
|
||||||
};
|
};
|
||||||
enum fsm_laufrichtung_t {
|
enum fsm_laufrichtung_t {
|
||||||
LR_RUNTER=0,
|
LR_RUNTER=0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user