Compare commits
74 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d6f35b82be | |||
| 3821724a06 | |||
| bcad1369af | |||
|
|
e4ad92ca99 | ||
|
|
89dcbf27ae | ||
|
|
a0f5ec26d2 | ||
|
|
c95ea1ed22 | ||
|
|
392f2c1bbc | ||
|
|
79e88d29c3 | ||
|
|
1686b9ea2a | ||
| 8c45c65d00 | |||
| 6bd0844927 | |||
| b309c0b207 | |||
| 767df957cc | |||
| 0d6f0b28e2 | |||
| 937f7f09e7 | |||
| 6ae3f5690f | |||
| 7c770a7802 | |||
| 6807d0f0af | |||
| 770c2436fd | |||
| 3145949020 | |||
| ca938ef3dd | |||
| f8fac7acfb | |||
| 9ed1b24316 | |||
| 125b39a418 | |||
| e47cae30a8 | |||
| b2ff66d44c | |||
| c23b9f2bc6 | |||
| 31c268487c | |||
| ad21d73fbb | |||
| 42a927e383 | |||
| 13db3da082 | |||
| 9518c06fd9 | |||
| 2820869e14 | |||
| 6e810fad59 | |||
| 79a9eecaad | |||
| 1189b7c3a4 | |||
| 7643961ed2 | |||
| 6cc52dc460 | |||
| d3ed19e639 | |||
| d55da4e6d7 | |||
| f677f18681 | |||
| f027478e2e | |||
| 5986beb10c | |||
|
|
f57e875a17 | ||
|
|
d16f3823b8 | ||
|
|
a5ac7d358b | ||
| 0cd46a3c9f | |||
| 3a93b8a002 | |||
| 0e5085c008 | |||
| 7177472ea6 | |||
| 03d0cfedd1 | |||
| 66d220cdb0 | |||
| 2754bd5247 | |||
| f62a18fe66 | |||
| 2139ff5943 | |||
| 6a04a4d1c9 | |||
| 630250da78 | |||
| 35ba3e7573 | |||
| 53efb0c309 | |||
| c1e24d633b | |||
| 5e36ef55df | |||
| 6b5cabb1f4 | |||
| 37380cbebc | |||
| 8c507083a7 | |||
| 2f6502ce20 | |||
| 278179fa6e | |||
| f38ef0ed0e | |||
| f2a9ed2888 | |||
| 1662079547 | |||
| 1e8d24dc40 | |||
| af40298378 | |||
| 8351a6430c | |||
| b2ddc978b6 |
52
README.md
52
README.md
@ -1,8 +1,9 @@
|
|||||||
### Steps to run it
|
### __How-To use this Project__
|
||||||
|
|
||||||
https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
|
1. Download and install [Visual Studio Code](https://code.visualstudio.com/download)
|
||||||
|
2. Install [PlatformIO IDE extension](https://platformio.org/install/ide?install=vscode) for Visual Studio Code
|
||||||
##### create "include/wifi_credentials.h"
|
3. Download sources from master branch, "zip" or "git clone"
|
||||||
|
4. Create [wifi_credentials.h](include/wifi_credentials.h) from [templ_wifi_credentials.h](include/templ_wifi_credentials.h) in include/
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#ifndef __WIFI_CREDENTIALS_H
|
#ifndef __WIFI_CREDENTIALS_H
|
||||||
@ -16,24 +17,31 @@ https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
|
|||||||
#endif // __WIFI_CREDENTIALS_H
|
#endif // __WIFI_CREDENTIALS_H
|
||||||
```
|
```
|
||||||
|
|
||||||
##### platformio.ini
|
5. Create [platformio.ini](platformio.ini) from [templ_platformio_ini](templ_platformio_ini)
|
||||||
see templ_platformio_ini
|
|
||||||
|
|
||||||
```ini
|
```sh
|
||||||
[env:<BOARD>]
|
$ cp templ_platformio_ini platformio.ini
|
||||||
platform = espressif8266
|
|
||||||
board = <BOARD>
|
|
||||||
framework = arduino
|
|
||||||
monitor_speed = 115200
|
|
||||||
|
|
||||||
extra_scripts = pre:extra_script.py
|
|
||||||
|
|
||||||
; stuff for OTA
|
|
||||||
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
|
|
||||||
upload_protocol = espota
|
|
||||||
upload_port = <IPADRESS>
|
|
||||||
upload_flags =
|
|
||||||
--port=8266
|
|
||||||
--auth=admin
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
6. __Uploading new firmware__
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# upload program via ota
|
||||||
|
$ pio run -t upload
|
||||||
|
# upload file system via ota
|
||||||
|
$ pio run -t uploadfs
|
||||||
|
|
||||||
|
# upload program via Serial Port
|
||||||
|
# Serial Port needs to be selected in platformio.ini
|
||||||
|
$ pio run -t upload -e serial
|
||||||
|
# upload file system via Serial Port
|
||||||
|
$ pio run -t uploadfs -e serial
|
||||||
|
```
|
||||||
|
|
||||||
|
------
|
||||||
|
|
||||||
|
Additional used sources and libraries in this project and [DOKU.md](DOKU.md)
|
||||||
|
- https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
|
||||||
|
- https://github.com/NachtRaveVL/PCA9685-Arduino
|
||||||
|
- https://arduino-esp8266.readthedocs.io/en/latest/gdb.html
|
||||||
|
- check different environments inside [platformio.ini](platformio.ini)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 209 KiB |
@ -1,67 +1,63 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>ESP8266 Treppenlicht</title>
|
<title>ESP8266 Treppenlicht</title>
|
||||||
<!-- main style sheet -->
|
|
||||||
<link href="/favicon.png" rel="icon" type="image/png" sizes="10x10">
|
<link href="/favicon.png" rel="icon" type="image/png" sizes="10x10">
|
||||||
<link href="/style.css" rel="stylesheet" type="text/css">
|
<link href="/style.css" rel="stylesheet" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="kopfzeile" style="text-align: center;">
|
<div class="topbar">Treppenlicht</div>
|
||||||
<b>Treppenlicht</b>
|
|
||||||
|
<div class="param_block">
|
||||||
|
<input type="button" class="control" data-action="s_oben" value="sensor_oben">
|
||||||
|
<input type="button" class="control" data-action="s_unten" value="sensor_unten">
|
||||||
|
<!-- <input type="button" class="control" data-action="on_off" value="on_off"> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ueberschrift">
|
<div class="param_block">
|
||||||
Helligkeit
|
Active Brightness: <output id="out_act_pwm" class="val_range">50</output> %
|
||||||
<!--<label id="label_pwm">
|
<div class="slider">
|
||||||
</label>-->
|
<input type="range" class="regler" id="range_act_pwm" data-output="out_act_pwm" min="0" max="100" value="50">
|
||||||
<div class="slider">
|
</div>
|
||||||
<input type="range" class="regler" id="helligkeit" name="rangeInput" min="0" max="100" value="50"
|
|
||||||
oninput="amount1.value=helligkeit.value">
|
|
||||||
<br>
|
|
||||||
<output name="amount1" id="amount1" for="helligkeit">50</output>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ueberschrift">
|
|
||||||
Helligkeit bei Dunkelheit
|
|
||||||
<!--<label id="label_pwm_dark">
|
|
||||||
</label>-->
|
|
||||||
<div class="slider">
|
|
||||||
<input type="range" class="regler" id="helligkeit_dunkel" name="rangeInput" min="0" max="100" value="50"
|
|
||||||
oninput="amount2.value=helligkeit_dunkel.value">
|
|
||||||
<br>
|
|
||||||
<output name="amount2" id="amount2" for="helligkeit_dunkel">50</output>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ueberschrift">
|
<div class="param_block">
|
||||||
Laufgeschwindigkeit
|
Idle Brightness Maximum: <output id="out_idl_pwm" class="val_range">50</output> %
|
||||||
<!--<label id="label_geschwindigkeit">
|
<label id="note">[100% == Active Brightness]</label>
|
||||||
</label>-->
|
<div class="slider">
|
||||||
<div class="slider">
|
<input type="range" class="regler" id="range_idl_pwm" data-output="out_idl_pwm" min="0" max="100" value="50">
|
||||||
<input type="range" class="regler" id="geschwindigkeit" name="rangeInput" min="0" max="100" value="50"
|
</div>
|
||||||
oninput="amount3.value=geschwindigkeit.value">
|
<label id="note">idle brightness gets controlled via LDR measurments</label>
|
||||||
<br>
|
|
||||||
<output name="amount3" id="amount3" for="geschwindigkeit">50</output>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ueberschrift">
|
<div class="param_block">
|
||||||
Licht-An-Zeit
|
Time per stair [ms]: <output id="out_tim_sta" class="val_range">300</output> ms
|
||||||
<!-- <label id="label_time">
|
|
||||||
</label>-->
|
<div class="slider">
|
||||||
<div class="slider">
|
<input type="range" class="regler" id="range_tim_sta" data-output="out_tim_sta" min="0" max="5000" value="300">
|
||||||
<input type="range" class="regler" id="time" name="rangeInput" min="0" max="100" value="50"
|
</div>
|
||||||
oninput="amount4.value=time.value">
|
|
||||||
<br>
|
|
||||||
<output name="amount4" id="amount4" for="time">50</output>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="param_block">
|
||||||
|
Time LDR [ms]: <output id="out_tim_ldr" class="val_range">500</output> ms
|
||||||
|
<div class="slider">
|
||||||
|
<input type="range" class="regler" id="range_tim_ldr" data-output="out_tim_ldr" min="0" max="5000" value="500">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="param_block">
|
||||||
|
LDR Schwelle [lx]: <output id="out_ldr_shw" class="val_range">50</output> lx
|
||||||
|
<div class="slider">
|
||||||
|
<input type="range" class="regler" id="range_ldr_shw" data-output="out_ldr_shw" min="0" max="1000" value="50">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="terminal">
|
<div class="terminal">
|
||||||
<input type="button" id="clear_term" value="clear" onclick="clearTerminal();">
|
<input type="button" id="clear_term" value="clear">
|
||||||
<input type="checkbox" id="scroll" name="scroll" value="scroll" checked>
|
<input type="checkbox" id="scroll" name="scroll" value="scroll" checked>
|
||||||
<label for="scroll"> autoscroll </label>
|
<label for="scroll"> autoscroll </label>
|
||||||
<textarea id="term">waiting for log messages ... </textarea>
|
<textarea id="term">waiting for log messages ... </textarea>
|
||||||
|
|||||||
140
data/input.js
140
data/input.js
@ -1,40 +1,120 @@
|
|||||||
// var slider = document.getElementById("helligkeit");
|
let rangeValues = {};
|
||||||
// var output = document.getElementById("l_pwm");
|
let xhrUpd = new XMLHttpRequest();
|
||||||
// output.innerHTML = slider.value; // Display the default slider value
|
|
||||||
|
|
||||||
// // Update the current slider value (each time you drag the slider handle)
|
xhrUpd.onreadystatechange = function () {
|
||||||
// slider.oninput = function() {
|
if (xhrUpd.readyState == 4) {
|
||||||
// output.innerHTML = this.value;
|
if (xhrUpd.status == 200) {
|
||||||
// }
|
console.log("xhrUpd: ", xhrUpd.responseText);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let xhr = new XMLHttpRequest();
|
|
||||||
|
|
||||||
xhr.onreadystatechange = function(){
|
|
||||||
if(xhr.readyState == 4) {
|
|
||||||
if (xhr.status == 200){
|
|
||||||
console.log(xhr.responseText);
|
|
||||||
terminal = document.getElementById("term");
|
|
||||||
autoscroll = document.getElementById("scroll");
|
|
||||||
terminal.innerHTML += xhr.responseText;
|
|
||||||
if(autoscroll.checked)
|
|
||||||
terminal.scrollTop = terminal.scrollHeight;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("status:", xhr.status);
|
console.log("xhrUpd: status=", xhrUpd.status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadTerminal() {
|
function reloadRangeValues() {
|
||||||
xhr.open("POST", "/app=terminal", true);
|
let url = "/update";
|
||||||
xhr.send();
|
// if there are scheduled updates, send them
|
||||||
setTimeout(reloadTerminal, 1000);
|
if (Object.keys(rangeValues).length > 0) {
|
||||||
|
let params = [];
|
||||||
|
for (let p in rangeValues)
|
||||||
|
params.push(encodeURIComponent(p) + "=" + encodeURIComponent(rangeValues[p]));
|
||||||
|
params = params.join("&");
|
||||||
|
|
||||||
|
xhrUpd.open("POST", url, true);
|
||||||
|
xhrUpd.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||||
|
xhrUpd.send(params);
|
||||||
|
|
||||||
|
rangeValues = {};
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
reloadTerminal();
|
function reloadTerminal() {
|
||||||
|
const terminal = document.querySelector("#term");
|
||||||
|
const autoscroll = document.querySelector("#scroll");
|
||||||
|
|
||||||
|
fetch('/terminal', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: ''
|
||||||
|
})
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
if(data.length > 0) {
|
||||||
|
terminal.innerHTML += data;
|
||||||
|
if (autoscroll.checked)
|
||||||
|
terminal.scrollTop = terminal.scrollHeight;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => console.log('Error:', error));
|
||||||
|
};
|
||||||
|
|
||||||
|
function updateParameters() {
|
||||||
|
fetch('/parameters', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: ''
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json_str => {
|
||||||
|
const active_pwm = Math.round(json_str.active_pwm / 4095 * 100);
|
||||||
|
document.querySelector('#range_act_pwm').value = active_pwm;
|
||||||
|
document.querySelector('#out_act_pwm').value = active_pwm;
|
||||||
|
|
||||||
|
const idle_pwm_max = Math.round(json_str.idle_pwm_max / json_str.active_pwm * 100);
|
||||||
|
document.querySelector('#range_idl_pwm').value = idle_pwm_max;
|
||||||
|
document.querySelector('#out_idl_pwm').value = idle_pwm_max;
|
||||||
|
|
||||||
|
document.querySelector('#range_tim_sta').value = json_str.time_per_stair;
|
||||||
|
document.querySelector('#out_tim_sta').value = json_str.time_per_stair;
|
||||||
|
|
||||||
|
document.querySelector('#range_tim_ldr').value = json_str.time_ldr;
|
||||||
|
document.querySelector('#out_tim_ldr').value = json_str.time_ldr;
|
||||||
|
|
||||||
|
document.querySelector('#range_ldr_shw').value = json_str.ldr_schwelle;
|
||||||
|
document.querySelector('#out_ldr_shw').value = json_str.ldr_schwelle;
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(error => console.log('Error:', error));
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
setInterval(reloadTerminal, 1000);
|
||||||
|
setInterval(reloadRangeValues, 1000);
|
||||||
|
|
||||||
|
updateParameters();
|
||||||
|
|
||||||
|
// use data- attributes for action
|
||||||
|
document.querySelectorAll('.control').forEach((button) => {
|
||||||
|
button.onclick = () => {
|
||||||
|
fetch('/action', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: `control=${button.dataset.action}`
|
||||||
|
})
|
||||||
|
.then(response => console.log(response))
|
||||||
|
.catch(error => console.log('Error:', error));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.regler').forEach((regler) => {
|
||||||
|
regler.oninput = () => {
|
||||||
|
document.querySelector(`#${regler.dataset.output}`).innerHTML = regler.value;
|
||||||
|
rangeValues[regler.id] = regler.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelector('#clear_term').onclick = () => {
|
||||||
|
document.querySelector("#term").innerHTML = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function clearTerminal() {
|
|
||||||
document.getElementById("term").innerHTML = '';
|
|
||||||
}
|
|
||||||
@ -1,45 +1,50 @@
|
|||||||
html {
|
html {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-family: sans-serif, Arial, Helvetica;
|
font-family: sans-serif, Arial, Helvetica;
|
||||||
background-color: #d4d4d4;
|
background-color: #ffffff;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
/* background-image: url('Background.png'); */
|
|
||||||
background-repeat: repeat;
|
|
||||||
background-size: 150% 150%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0 auto;
|
|
||||||
border: none;
|
|
||||||
border-radius: 3;
|
border-radius: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar {
|
.topbar {
|
||||||
padding: 1em;
|
padding: 10px;
|
||||||
background-color: #1f1f1f;
|
background-color: #585858;
|
||||||
color: white;
|
color: white;
|
||||||
|
font-size: xx-large;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param_block{
|
||||||
|
padding: 1em;
|
||||||
|
color: #000000;
|
||||||
|
border: 1px solid darkred;
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
text-align: center;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ueberschrift{
|
.val_range {
|
||||||
color: #ffffff;
|
font-weight: bold;
|
||||||
font-size: 50px;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.regler{
|
.regler {
|
||||||
|
/* -webkit-appearance: none; */
|
||||||
-webkit-appearance: none;
|
height: 50px;
|
||||||
height: 30px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
outline: black;
|
outline: black;
|
||||||
background-color: rgb(176, 188, 228);
|
background-color: rgb(176, 188, 228);
|
||||||
}
|
}
|
||||||
.regler::-webkit-slider-thumb{
|
|
||||||
|
#note {
|
||||||
|
font-size: medium;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .regler::-webkit-slider-thumb{
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
width: 5%;
|
width: 5%;
|
||||||
@ -47,29 +52,21 @@ body {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: rgb(107, 122, 192);
|
background-color: rgb(107, 122, 192);
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
} */
|
||||||
input[type=range]::-webkit-slider-thumb{
|
/* input[type=range]::-webkit-slider-thumb{
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
border:none;
|
border:none;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 4%;
|
width: 4%;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
}
|
} */
|
||||||
.slider {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.kopfzeile{
|
.slider {
|
||||||
color: #1f1f1f;
|
margin: 1%;
|
||||||
font-size: 50px;
|
|
||||||
width: 100%;
|
|
||||||
background-color: #8d8a8a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------*/
|
/*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/*Switch:
|
/*Switch:
|
||||||
.switch {
|
.switch {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -120,3 +117,18 @@ input:checked + .slider:before {
|
|||||||
#clear_term {
|
#clear_term {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type="number"] {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:invalid+span:after {
|
||||||
|
content: '✖';
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:valid+span:after {
|
||||||
|
content: '✓';
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
59
doku.md
59
doku.md
@ -54,14 +54,27 @@ else
|
|||||||
server.streamFile(f, mime::getContentType(SRH::_path), requestMethod);
|
server.streamFile(f, mime::getContentType(SRH::_path), requestMethod);
|
||||||
```
|
```
|
||||||
|
|
||||||
LED_sequence_v1:
|
### HW issues
|
||||||
|
- GPIO2 used as input -> must be high during startup
|
||||||
|
- PCB Solution: cut trace to GPIO2, solder bridge to GPIO16
|
||||||
|
- -> disadvantage: GPIO16 is not interrupt capable
|
||||||
|
|
||||||
|
|
||||||
|
### FSM 2 - to do
|
||||||
|
- stairway light switches off after timeout
|
||||||
|
- switches concurrently on again if sensor is still high
|
||||||
|
- desired behavior? Defective Sensor would cause continuos animation
|
||||||
|
- edge detection / interrupts as solution ?
|
||||||
|
|
||||||
|
|
||||||
|
### LED_sequence_v1:
|
||||||
TODO:
|
TODO:
|
||||||
- disable led stripes after defined time (webserver paramter?)
|
- disable led stripes after defined time (webserver paramter?)
|
||||||
- define what to do if people enter stairs from different directions
|
- define what to do if people enter stairs from different directions
|
||||||
- CAUTION: Sensor-Deadtime at LEAST 8 seconds
|
- CAUTION: Sensor-Deadtime at LEAST 8 seconds
|
||||||
- --> switch off with person leaving stairs might not be possible
|
- --> switch off with person leaving stairs might not be possible
|
||||||
|
|
||||||
Webserver on v0.3.0 now working with LittleFS
|
### Webserver on v0.3.0 now working with LittleFS
|
||||||
TODO:
|
TODO:
|
||||||
- check dir for files automatic
|
- check dir for files automatic
|
||||||
- move handleNotFound to httpserver.h
|
- move handleNotFound to httpserver.h
|
||||||
@ -84,3 +97,45 @@ 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 !__
|
||||||
|
__=> serverStatic("/") works wonders__
|
||||||
|
|
||||||
|
|
||||||
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARHRRHRGH
|
||||||
|
Two implementations of FSM are not that good,
|
||||||
|
linker puts them together ?!?
|
||||||
|
:):):):):):):)
|
||||||
|
=> maybe investigate for doc
|
||||||
|
|
||||||
|
### TODO Treppe
|
||||||
|
- dynamic lighting with ldr
|
||||||
|
- http control over active pwm ... => set_active_pwm()
|
||||||
|
-> is implemntiert, kann mit % oder abs eingestellt werden
|
||||||
|
- testing if dimming crashes when two animations
|
||||||
|
-> ldr does not interrupt animation, animation get's finished and stairs fade out -> FSM works without collisions
|
||||||
|
- interrupt to pending from sensors
|
||||||
|
-> rising edge trigger implemented, via pending input
|
||||||
|
- settings struct
|
||||||
|
-> implemented with EEPROM
|
||||||
|
-> adapted to only change on ruhezustand
|
||||||
|
- script for gdb on windows
|
||||||
|
-> [implemented](start_xtensa_gdb_stub.cmd)
|
||||||
|
- welcome animation ?
|
||||||
|
-> wird hochgedimmt beim einschalten von 0
|
||||||
|
- on/off switch http
|
||||||
|
- use logging to serial http monitor with httpserver.logt()
|
||||||
|
-> is used for some status updates
|
||||||
|
|
||||||
|
- behavior when someone enters stairway from opposite direction while animation is running?
|
||||||
|
-> currently ignored, second persons walks in darkness
|
||||||
|
-> animation from both sides?
|
||||||
|
-> problem: person 1 leaving stairway might pass the sensor right after person 2 -> person 1 leaving not detected
|
||||||
|
|
||||||
|
- behavior when someone enters stairway from opposite direction after animation finished but person 1 is still on stairway?
|
||||||
|
-> currently stairs fade off from direction 1
|
||||||
|
-> additional wait-state between "warten hoch/runter" and "abdimmen hoch/runter" after sensor detected person?
|
||||||
|
|
||||||
|
|
||||||
|
- active brightness can be lower than idle in the moment
|
||||||
|
- change idle to precentage of active !!
|
||||||
|
|
||||||
|
- Webpage needs to load settings from eeprom !!
|
||||||
@ -1,8 +1,9 @@
|
|||||||
#pragma once
|
#ifndef __OTA_H
|
||||||
|
#define __OTA_H
|
||||||
|
|
||||||
|
#include <ArduinoOTA.h>
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <ArduinoOTA.h>
|
|
||||||
|
|
||||||
void ota_setup() {
|
void ota_setup() {
|
||||||
ArduinoOTA.setPort(8266);
|
ArduinoOTA.setPort(8266);
|
||||||
@ -46,3 +47,5 @@ void ota_setup() {
|
|||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // __OTA_H
|
||||||
|
|||||||
9
include/templ_wifi_credentials.h
Normal file
9
include/templ_wifi_credentials.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef __WIFI_CREDENTIALS_H
|
||||||
|
#define __WIFI_CREDENTIALS_H
|
||||||
|
|
||||||
|
#ifndef STASSID
|
||||||
|
#define STASSID "ssid"
|
||||||
|
#define STAPSK "key"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __WIFI_CREDENTIALS_H
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
FSInfo fsinfo;
|
FSInfo fsinfo;
|
||||||
|
|
||||||
bool mount_fs() {
|
auto mount_fs() -> bool {
|
||||||
if(!LittleFS.begin()) {
|
if(!LittleFS.begin()) {
|
||||||
Serial.println("[ERROR] LittleFS.info(), reset ...");
|
Serial.println("[ERROR] LittleFS.info(), reset ...");
|
||||||
return false;
|
return false;
|
||||||
@ -25,7 +25,7 @@ bool mount_fs() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool format_fs() {
|
auto format_fs() -> bool {
|
||||||
printf("Formatting FS ! \n\r");
|
printf("Formatting FS ! \n\r");
|
||||||
return LittleFS.format();
|
return LittleFS.format();
|
||||||
}
|
}
|
||||||
@ -122,7 +122,3 @@ void deleteFile(const char * path) {
|
|||||||
Serial.println("Delete failed");
|
Serial.println("Delete failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -3,7 +3,6 @@
|
|||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
|
|
||||||
// some usefull wrappers for Filesystem
|
// some usefull wrappers for Filesystem
|
||||||
|
|
||||||
bool mount_fs();
|
bool mount_fs();
|
||||||
bool format_fs();
|
bool format_fs();
|
||||||
|
|
||||||
|
|||||||
@ -1,68 +1,122 @@
|
|||||||
#include "httpserver.h"
|
#include "httpserver.h"
|
||||||
|
|
||||||
|
auto HTTPServer::start() -> bool {
|
||||||
|
if (!mount_fs()) {
|
||||||
|
logf("cant mount filesystem, EXIT !\n\r");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool HTTPServer::start() {
|
logf("LittleFS mounted !\n\r");
|
||||||
if(!mount_fs()) {
|
logf("root:\n\r");
|
||||||
logf("cant mount filesystem, EXIT !\n\r");
|
this->listRoot();
|
||||||
return false;
|
logf("\n\r");
|
||||||
|
|
||||||
|
// default handler
|
||||||
|
this->onNotFound([this]() {
|
||||||
|
String message = "File Not Found\n\n";
|
||||||
|
message += "URI: ";
|
||||||
|
message += uri();
|
||||||
|
message += "\nMethod: ";
|
||||||
|
message += (method() == HTTP_GET) ? "GET" : "POST";
|
||||||
|
message += "\nArguments: ";
|
||||||
|
message += args();
|
||||||
|
message += "\n";
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < args(); i++) {
|
||||||
|
message += " " + argName(i) + ": " + arg(i) + "\n";
|
||||||
}
|
}
|
||||||
logf("LittleFS mounted !\n\r");
|
send(404, "text/plain", message);
|
||||||
logf("root:\n\r");
|
});
|
||||||
this->listRoot();
|
|
||||||
logf("\n\r");
|
|
||||||
|
|
||||||
// default handler
|
// add static root file handler for http
|
||||||
this->onNotFound([this]() {
|
this->serveStatic("/", LittleFS, "/");
|
||||||
String message = "File Not Found\n\n";
|
this->begin();
|
||||||
message += "URI: ";
|
logf("Server active on Port 80 !\n\r");
|
||||||
message += uri();
|
return true;
|
||||||
message += "\nMethod: ";
|
|
||||||
message += (method() == HTTP_GET) ? "GET" : "POST";
|
|
||||||
message += "\nArguments: ";
|
|
||||||
message += args();
|
|
||||||
message += "\n";
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < args(); i++) {
|
|
||||||
message += " " + argName(i) + ": " + arg(i) + "\n";
|
|
||||||
}
|
|
||||||
send(404, "text/plain", message);
|
|
||||||
});
|
|
||||||
|
|
||||||
// add static root file handler for http
|
|
||||||
this->serveStatic("/", LittleFS, "/");
|
|
||||||
this->begin();
|
|
||||||
Serial.printf("Server active on Port 80 !\n\r");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HTTPServer::logf(const char *format, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
char temp[64];
|
|
||||||
size_t len = vsnprintf(temp, sizeof(temp), format, args);
|
|
||||||
Serial.print(log_prefix);
|
|
||||||
Serial.write(temp, len);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HTTPServer::logt(const char *format, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
// append logging string to local buffer
|
|
||||||
if(tbuf_head < TBUF_LEN) {
|
|
||||||
size_t len = vsnprintf(tbuf+tbuf_head, TBUF_LEN-tbuf_head, format, args);
|
|
||||||
tbuf_head += len;
|
|
||||||
}
|
|
||||||
va_end(args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPServer::start_apps() {
|
void HTTPServer::start_apps() {
|
||||||
// application handler
|
this->on("/action", HTTP_POST, [this]() {
|
||||||
this->on("/app=terminal", HTTP_POST, [this]() {
|
if (args()) {
|
||||||
if(tbuf_head) {
|
logf("%s=%s\n", argName(0).c_str(), arg(0).c_str());
|
||||||
send(200, "text/plain", tbuf);
|
|
||||||
tbuf_head = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if (argName(0).equals("control")) {
|
||||||
|
if (arg(0).equals("s_oben")) {
|
||||||
|
treppe->overwrite_sensors(true, false);
|
||||||
|
logt("control => s_oben !\n");
|
||||||
|
}
|
||||||
|
else if (arg(0).equals("s_unten")) {
|
||||||
|
treppe->overwrite_sensors(false, true);
|
||||||
|
logt("control => s_unten !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send(200, "text/plain", "accepted");
|
||||||
|
});
|
||||||
|
|
||||||
|
this->on("/update", HTTP_POST, [this]() {
|
||||||
|
if (args()) {
|
||||||
|
for (int i = 0; i < args() - 1; i++) {
|
||||||
|
logf("%s=%s\n", argName(i).c_str(), arg(i).c_str());
|
||||||
|
|
||||||
|
if (argName(i).equals("range_act_pwm")) {
|
||||||
|
treppe->set_active_pwm(arg(i).toInt(), VORGABE_PROZENT);
|
||||||
|
logt("set_active_pwm = %d %\n", arg(i).toInt());
|
||||||
|
}
|
||||||
|
else if (argName(i).equals("range_idl_pwm")) {
|
||||||
|
treppe->set_idle_pwm_max(arg(i).toInt(), VORGABE_PROZENT);
|
||||||
|
logt("set_idle_pwm_max = %d %\n", arg(i).toInt());
|
||||||
|
}
|
||||||
|
else if (argName(i).equals("range_tim_sta")) {
|
||||||
|
treppe->set_time_per_stair(arg(i).toInt());
|
||||||
|
logt("set_time_per_stair = %d\n", arg(i).toInt());
|
||||||
|
}
|
||||||
|
else if (argName(i).equals("range_tim_ldr")) {
|
||||||
|
treppe->set_time_ldr(arg(i).toInt());
|
||||||
|
logt("set_time_ldr = %d\n", arg(i).toInt());
|
||||||
|
}
|
||||||
|
else if (argName(i).equals("range_ldr_shw")) {
|
||||||
|
treppe->set_ldr_schwelle(arg(i).toInt(), VORGABE_12BIT);
|
||||||
|
logt("set_ldr_schwelle = %d %\n", arg(i).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send(200, "text/plain", "accepted");
|
||||||
|
});
|
||||||
|
|
||||||
|
this->on("/terminal", HTTP_POST, [this]() {
|
||||||
|
// logf("got /terminal\n");
|
||||||
|
if (tbuf_head) {
|
||||||
|
send(200, "text/plain", tbuf);
|
||||||
|
tbuf_head = 0;
|
||||||
|
} else {
|
||||||
|
send(202, "text/plain", "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this->on("/parameters", HTTP_POST, [this]() {
|
||||||
|
logt("got /parameters\n");
|
||||||
|
char json_str[255];
|
||||||
|
treppe->param_to_json(json_str, 255);
|
||||||
|
logt("%s\n", json_str);
|
||||||
|
send(200, "application/json", json_str);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class... Args>
|
||||||
|
void HTTPServer::logf(const char *format, Args... args) const {
|
||||||
|
Serial.print(log_prefix);
|
||||||
|
Serial.printf(format, args...);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HTTPServer::logt(const char *format, ...) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
// append logging string to local buffer
|
||||||
|
if (tbuf_head < TBUF_LEN) {
|
||||||
|
tbuf_head +=
|
||||||
|
vsnprintf(tbuf + tbuf_head, TBUF_LEN - tbuf_head, format, args);
|
||||||
|
}
|
||||||
|
va_end(args);
|
||||||
}
|
}
|
||||||
@ -1,42 +1,40 @@
|
|||||||
|
#ifndef __HTTPSERVER_H
|
||||||
|
#define __HTTPSERVER_H
|
||||||
// Wrapper for ESP8266WebServer with Filesystem as HTTP source
|
// Wrapper for ESP8266WebServer with Filesystem as HTTP source
|
||||||
|
|
||||||
#pragma once
|
#include "filesys.h"
|
||||||
|
#include "treppe.h"
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "filesys.h"
|
|
||||||
|
|
||||||
// debug log <ESP8266WebServer.h>
|
// debug log <ESP8266WebServer.h>
|
||||||
// #define DEBUGV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
|
// #define DEBUGV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
|
||||||
|
|
||||||
#define TBUF_LEN 256
|
#define TBUF_LEN 256
|
||||||
|
|
||||||
|
|
||||||
class HTTPServer : public ESP8266WebServer {
|
class HTTPServer : public ESP8266WebServer {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* rootDir = "/";
|
const char *rootDir = "/";
|
||||||
const char* log_prefix = "[HTTPServer] ";
|
const char *log_prefix = "[HTTPServer] ";
|
||||||
|
|
||||||
size_t tbuf_head = 0;
|
size_t tbuf_head = 0;
|
||||||
char tbuf[TBUF_LEN];
|
char tbuf[TBUF_LEN];
|
||||||
|
|
||||||
void listRoot() {
|
void listRoot() { ls(rootDir); }
|
||||||
ls(rootDir);
|
Treppe *treppe;
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HTTPServer(const int _port, const char* _rootDir) :
|
HTTPServer(const int _port, const char *_rootDir, Treppe *_treppe)
|
||||||
ESP8266WebServer(_port), rootDir(_rootDir)
|
: ESP8266WebServer(_port), rootDir(_rootDir), treppe(_treppe) {}
|
||||||
{ }
|
~HTTPServer() { Serial.printf("[HTTPServer] shut down ...\n\r"); }
|
||||||
~HTTPServer()
|
|
||||||
{
|
|
||||||
Serial.printf("[HTTPServer] shut down ...\n\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool start();
|
bool start();
|
||||||
void start_apps();
|
void start_apps();
|
||||||
|
|
||||||
void logf(const char *format, ...);
|
template <class... Args>
|
||||||
void logt(const char *format, ...);
|
void logf(const char *format, Args... args) const;
|
||||||
|
void logt(const char *format, ...);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // __HTTPSERVER_H
|
||||||
@ -7,33 +7,36 @@
|
|||||||
//
|
//
|
||||||
// Code generated for Simulink model 'FSMTreppe'.
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
//
|
//
|
||||||
// Model version : 1.29
|
// Model version : 1.65
|
||||||
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
// C/C++ source code generated on : Sat Jul 3 17:39:25 2021
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 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
|
||||||
// Code generation objectives: Unspecified
|
// Code generation objectives: Unspecified
|
||||||
// Validation result: Not run
|
// Validation result: Not run
|
||||||
//
|
//
|
||||||
#include "FSMTreppe2.h"
|
#include "FSMTreppe4.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// Named constants for Chart: '<Root>/FSMTreppe'
|
// Named constants for Chart: '<Root>/FSMTreppe'
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_hoch = 1U;
|
const uint8_t FSMTreppe_IN_abdimmen_hoch = 1U;
|
||||||
const uint8_t FSMTreppe_IN_abdimmen_runter = 2U;
|
const uint8_t FSMTreppe_IN_abdimmen_ldr = 2U;
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_hoch = 3U;
|
const uint8_t FSMTreppe_IN_abdimmen_runter = 3U;
|
||||||
const uint8_t FSMTreppe_IN_aufdimmen_runter = 4U;
|
const uint8_t FSMTreppe_IN_aufdimmen_hoch = 4U;
|
||||||
const uint8_t FSMTreppe_IN_inaktiv = 5U;
|
const uint8_t FSMTreppe_IN_aufdimmen_ldr = 5U;
|
||||||
const uint8_t FSMTreppe_IN_ruhezustand = 6U;
|
const uint8_t FSMTreppe_IN_aufdimmen_runter = 6U;
|
||||||
const uint8_t FSMTreppe_IN_warten_hoch = 7U;
|
const uint8_t FSMTreppe_IN_dimm_regelung = 7U;
|
||||||
const uint8_t FSMTreppe_IN_warten_runter = 8U;
|
const uint8_t FSMTreppe_IN_inaktiv = 8U;
|
||||||
|
const uint8_t FSMTreppe_IN_ruhezustand = 9U;
|
||||||
|
const uint8_t FSMTreppe_IN_warten_hoch = 10U;
|
||||||
|
const uint8_t FSMTreppe_IN_warten_runter = 11U;
|
||||||
|
|
||||||
// Model step function
|
// Model step function
|
||||||
void FSMTreppeModelClass::step()
|
void FSMTreppeModelClass::step()
|
||||||
{
|
{
|
||||||
// Chart: '<Root>/FSMTreppe' incorporates:
|
// Chart: '<Root>/FSMTreppe' incorporates:
|
||||||
// Inport: '<Root>/anim_beendet'
|
// Inport: '<Root>/anim_beendet'
|
||||||
|
// Inport: '<Root>/ldr_changed'
|
||||||
// Inport: '<Root>/ldr_schwelle'
|
// Inport: '<Root>/ldr_schwelle'
|
||||||
// Inport: '<Root>/sensor_oben'
|
// Inport: '<Root>/sensor_oben'
|
||||||
// Inport: '<Root>/sensor_unten'
|
// Inport: '<Root>/sensor_unten'
|
||||||
@ -56,13 +59,28 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 4U;
|
FSMTreppe_Y.status = 6U;
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
{
|
500U)) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 1U;
|
FSMTreppe_Y.status = 3U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_abdimmen_ldr:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 2U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
|
500U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 0U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -71,13 +89,13 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 7U;
|
FSMTreppe_Y.status = 9U;
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
{
|
500U)) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 1U;
|
FSMTreppe_Y.status = 3U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -89,12 +107,27 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 2U;
|
FSMTreppe_Y.status = 4U;
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
{
|
500U)) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_hoch;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_hoch;
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 5U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_aufdimmen_ldr:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 1U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
|
500U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 3U;
|
FSMTreppe_Y.status = 3U;
|
||||||
}
|
}
|
||||||
@ -108,32 +141,48 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 5U;
|
FSMTreppe_Y.status = 7U;
|
||||||
if (FSMTreppe_U.anim_beendet || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
{
|
500U)) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_runter;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_warten_runter;
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 6U;
|
FSMTreppe_Y.status = 8U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_dimm_regelung:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 10U;
|
||||||
|
if ((FSMTreppe_DW.temporalCounter_i1 >= 500U) || (FSMTreppe_U.anim_beendet
|
||||||
|
== 1U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 3U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSMTreppe_IN_inaktiv:
|
case FSMTreppe_IN_inaktiv:
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 0U;
|
FSMTreppe_Y.status = 0U;
|
||||||
if (FSMTreppe_U.ldr_schwelle == 1.0) {
|
if (FSMTreppe_U.ldr_schwelle == 1U) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_ldr;
|
||||||
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 1U;
|
FSMTreppe_Y.status = 1U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSMTreppe_IN_ruhezustand:
|
case FSMTreppe_IN_ruhezustand:
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 1U;
|
FSMTreppe_Y.status = 3U;
|
||||||
if (FSMTreppe_U.sensor_unten) {
|
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;
|
||||||
|
|
||||||
@ -144,8 +193,8 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 2U;
|
FSMTreppe_Y.status = 4U;
|
||||||
} else if (FSMTreppe_U.sensor_oben) {
|
} else if (FSMTreppe_U.sensor_oben == 1U) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_runter;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_runter;
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
@ -156,20 +205,30 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 1U;
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 5U;
|
FSMTreppe_Y.status = 7U;
|
||||||
} else if (FSMTreppe_U.ldr_schwelle == 0.0) {
|
} else if (FSMTreppe_U.ldr_schwelle == 0U) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_ldr;
|
||||||
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 0U;
|
FSMTreppe_Y.status = 2U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
} else if (FSMTreppe_U.ldr_changed == 1U) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_dimm_regelung;
|
||||||
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 10U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSMTreppe_IN_warten_hoch:
|
case FSMTreppe_IN_warten_hoch:
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 3U;
|
FSMTreppe_Y.status = 5U;
|
||||||
if (FSMTreppe_U.sensor_oben || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
if ((FSMTreppe_U.sensor_oben == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
{
|
500U)) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_hoch;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_hoch;
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
@ -177,16 +236,16 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 4U;
|
FSMTreppe_Y.status = 6U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
// case IN_warten_runter:
|
// case IN_warten_runter:
|
||||||
FSMTreppe_Y.status = 6U;
|
FSMTreppe_Y.status = 8U;
|
||||||
if (FSMTreppe_U.sensor_unten || (FSMTreppe_DW.temporalCounter_i1 >= 500U))
|
if ((FSMTreppe_U.sensor_unten == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
{
|
500U)) {
|
||||||
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_runter;
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_abdimmen_runter;
|
||||||
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
@ -194,7 +253,7 @@ void FSMTreppeModelClass::step()
|
|||||||
FSMTreppe_Y.dimmrichtung = 0U;
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
|
||||||
// Outport: '<Root>/status'
|
// Outport: '<Root>/status'
|
||||||
FSMTreppe_Y.status = 7U;
|
FSMTreppe_Y.status = 9U;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -7,9 +7,9 @@
|
|||||||
//
|
//
|
||||||
// Code generated for Simulink model 'FSMTreppe'.
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
//
|
//
|
||||||
// Model version : 1.28
|
// Model version : 1.65
|
||||||
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
// C/C++ source code generated on : Sat Jul 3 13:50:17 2021
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 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
|
||||||
@ -34,17 +34,18 @@ class FSMTreppeModelClass {
|
|||||||
|
|
||||||
// External inputs (root inport signals with default storage)
|
// External inputs (root inport signals with default storage)
|
||||||
struct ExtU_FSMTreppe_T {
|
struct ExtU_FSMTreppe_T {
|
||||||
bool sensor_unten; // '<Root>/sensor_unten'
|
uint32_t sensor_unten; // '<Root>/sensor_unten'
|
||||||
bool sensor_oben; // '<Root>/sensor_oben'
|
uint32_t sensor_oben; // '<Root>/sensor_oben'
|
||||||
bool anim_beendet; // '<Root>/anim_beendet'
|
uint32_t anim_beendet; // '<Root>/anim_beendet'
|
||||||
double ldr_schwelle; // '<Root>/ldr_schwelle'
|
uint32_t ldr_schwelle; // '<Root>/ldr_schwelle'
|
||||||
|
uint32_t ldr_changed; // '<Root>/ldr_changed'
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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 {
|
||||||
uint8_t laufrichtung; // '<Root>/laufrichtung'
|
uint32_t laufrichtung; // '<Root>/laufrichtung'
|
||||||
uint8_t status; // '<Root>/status'
|
uint32_t status; // '<Root>/status'
|
||||||
uint8_t dimmrichtung; // '<Root>/dimmrichtung'
|
uint32_t dimmrichtung; // '<Root>/dimmrichtung'
|
||||||
};
|
};
|
||||||
|
|
||||||
// model initialize function
|
// model initialize function
|
||||||
304
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe.cpp
Normal file
304
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe.cpp
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
//
|
||||||
|
// 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.65
|
||||||
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 2021
|
||||||
|
//
|
||||||
|
// Target selection: ert.tlc
|
||||||
|
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||||
|
// Code generation objectives: Unspecified
|
||||||
|
// Validation result: Not run
|
||||||
|
//
|
||||||
|
#include "FSMTreppe.h"
|
||||||
|
#include "FSMTreppe_private.h"
|
||||||
|
|
||||||
|
// Named constants for Chart: '<Root>/FSMTreppe'
|
||||||
|
const uint8_T FSMTreppe_IN_abdimmen_hoch = 1U;
|
||||||
|
const uint8_T FSMTreppe_IN_abdimmen_ldr = 2U;
|
||||||
|
const uint8_T FSMTreppe_IN_abdimmen_runter = 3U;
|
||||||
|
const uint8_T FSMTreppe_IN_aufdimmen_hoch = 4U;
|
||||||
|
const uint8_T FSMTreppe_IN_aufdimmen_ldr = 5U;
|
||||||
|
const uint8_T FSMTreppe_IN_aufdimmen_runter = 6U;
|
||||||
|
const uint8_T FSMTreppe_IN_dimm_regelung = 7U;
|
||||||
|
const uint8_T FSMTreppe_IN_inaktiv = 8U;
|
||||||
|
const uint8_T FSMTreppe_IN_ruhezustand = 9U;
|
||||||
|
const uint8_T FSMTreppe_IN_warten_hoch = 10U;
|
||||||
|
const uint8_T FSMTreppe_IN_warten_runter = 11U;
|
||||||
|
|
||||||
|
// Model step function
|
||||||
|
void FSMTreppeModelClass::step()
|
||||||
|
{
|
||||||
|
// Chart: '<Root>/FSMTreppe' incorporates:
|
||||||
|
// Inport: '<Root>/anim_beendet'
|
||||||
|
// Inport: '<Root>/ldr_changed'
|
||||||
|
// 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 = 6U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
|
500U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 3U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_abdimmen_ldr:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 2U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
|
500U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_inaktiv;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 0U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_abdimmen_runter:
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 0U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 9U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
|
500U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 3U;
|
||||||
|
}
|
||||||
|
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 = 4U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (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 = 5U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_aufdimmen_ldr:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 1U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (FSMTreppe_DW.temporalCounter_i1 >=
|
||||||
|
500U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
|
// 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 = 7U;
|
||||||
|
if ((FSMTreppe_U.anim_beendet == 1U) || (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 = 8U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_dimm_regelung:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 10U;
|
||||||
|
if ((FSMTreppe_DW.temporalCounter_i1 >= 500U) || (FSMTreppe_U.anim_beendet
|
||||||
|
== 1U)) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_ruhezustand;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 3U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_inaktiv:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 0U;
|
||||||
|
if (FSMTreppe_U.ldr_schwelle == 1U) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_aufdimmen_ldr;
|
||||||
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 1U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/dimmrichtung'
|
||||||
|
FSMTreppe_Y.dimmrichtung = 1U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_ruhezustand:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 3U;
|
||||||
|
if (FSMTreppe_U.sensor_unten == 1U) {
|
||||||
|
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 = 4U;
|
||||||
|
} else if (FSMTreppe_U.sensor_oben == 1U) {
|
||||||
|
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 = 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;
|
||||||
|
} else if (FSMTreppe_U.ldr_changed == 1U) {
|
||||||
|
FSMTreppe_DW.is_c3_FSMTreppe = FSMTreppe_IN_dimm_regelung;
|
||||||
|
FSMTreppe_DW.temporalCounter_i1 = 0U;
|
||||||
|
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 10U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FSMTreppe_IN_warten_hoch:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
FSMTreppe_Y.status = 5U;
|
||||||
|
if ((FSMTreppe_U.sensor_oben == 1U) || (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 = 6U;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Outport: '<Root>/status'
|
||||||
|
// case IN_warten_runter:
|
||||||
|
FSMTreppe_Y.status = 8U;
|
||||||
|
if ((FSMTreppe_U.sensor_unten == 1U) || (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 = 9U;
|
||||||
|
}
|
||||||
|
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(),
|
||||||
|
FSMTreppe_M()
|
||||||
|
{
|
||||||
|
// Currently there is no constructor body generated.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
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.
|
||||||
|
//
|
||||||
|
// [EOF]
|
||||||
|
//
|
||||||
140
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe.h
Normal file
140
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe.h
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
//
|
||||||
|
// 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.65
|
||||||
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 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 "rtwtypes.h"
|
||||||
|
#include "FSMTreppe_types.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
|
||||||
|
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 {
|
||||||
|
uint32_T sensor_unten; // '<Root>/sensor_unten'
|
||||||
|
uint32_T sensor_oben; // '<Root>/sensor_oben'
|
||||||
|
uint32_T anim_beendet; // '<Root>/anim_beendet'
|
||||||
|
uint32_T ldr_schwelle; // '<Root>/ldr_schwelle'
|
||||||
|
uint32_T ldr_changed; // '<Root>/ldr_changed'
|
||||||
|
};
|
||||||
|
|
||||||
|
// External outputs (root outports fed by signals with default storage)
|
||||||
|
struct ExtY_FSMTreppe_T {
|
||||||
|
uint32_T laufrichtung; // '<Root>/laufrichtung'
|
||||||
|
uint32_T status; // '<Root>/status'
|
||||||
|
uint32_T dimmrichtung; // '<Root>/dimmrichtung'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Real-time Model Data Structure
|
||||||
|
struct RT_MODEL_FSMTreppe_T {
|
||||||
|
const char_T * volatile errorStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Real-Time Model get method
|
||||||
|
FSMTreppeModelClass::RT_MODEL_FSMTreppe_T * getRTM();
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// Real-Time Model
|
||||||
|
RT_MODEL_FSMTreppe_T FSMTreppe_M;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-
|
||||||
|
// 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]
|
||||||
|
//
|
||||||
28
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe_private.h
Normal file
28
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe_private.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// 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_private.h
|
||||||
|
//
|
||||||
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
|
//
|
||||||
|
// Model version : 1.65
|
||||||
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 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_private_h_
|
||||||
|
#define RTW_HEADER_FSMTreppe_private_h_
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#endif // RTW_HEADER_FSMTreppe_private_h_
|
||||||
|
|
||||||
|
//
|
||||||
|
// File trailer for generated code.
|
||||||
|
//
|
||||||
|
// [EOF]
|
||||||
|
//
|
||||||
29
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe_types.h
Normal file
29
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/FSMTreppe_types.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
//
|
||||||
|
// 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_types.h
|
||||||
|
//
|
||||||
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
|
//
|
||||||
|
// Model version : 1.65
|
||||||
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 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_types_h_
|
||||||
|
#define RTW_HEADER_FSMTreppe_types_h_
|
||||||
|
|
||||||
|
// Model Code Variants
|
||||||
|
#endif // RTW_HEADER_FSMTreppe_types_h_
|
||||||
|
|
||||||
|
//
|
||||||
|
// File trailer for generated code.
|
||||||
|
//
|
||||||
|
// [EOF]
|
||||||
|
//
|
||||||
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/buildInfo.mat
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/buildInfo.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/codeInfo.mat
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/codeInfo.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/codedescriptor.dmr
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/codedescriptor.dmr
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/compileInfo.mat
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/compileInfo.mat
Normal file
Binary file not shown.
14
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/defines.txt
Normal file
14
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/defines.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
MODEL=FSMTreppe
|
||||||
|
NUMST=1
|
||||||
|
NCSTATES=0
|
||||||
|
HAVESTDIO
|
||||||
|
MODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0
|
||||||
|
CLASSIC_INTERFACE=0
|
||||||
|
ALLOCATIONFCN=0
|
||||||
|
TID01EQ=0
|
||||||
|
TERMFCN=1
|
||||||
|
ONESTEPFCN=1
|
||||||
|
MAT_FILE=0
|
||||||
|
MULTI_INSTANCE_CODE=1
|
||||||
|
INTEGER_CODE=0
|
||||||
|
MT=0
|
||||||
109
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/ert_main.cpp
Normal file
109
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/ert_main.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
//
|
||||||
|
// 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: ert_main.cpp
|
||||||
|
//
|
||||||
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
|
//
|
||||||
|
// Model version : 1.65
|
||||||
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 2021
|
||||||
|
//
|
||||||
|
// Target selection: ert.tlc
|
||||||
|
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||||
|
// Code generation objectives: Unspecified
|
||||||
|
// Validation result: Not run
|
||||||
|
//
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h> // This ert_main.c example uses printf/fflush
|
||||||
|
#include "FSMTreppe.h" // Model's header file
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
|
||||||
|
static FSMTreppeModelClass FSMTreppe_Obj;// Instance of model class
|
||||||
|
|
||||||
|
//
|
||||||
|
// Associating rt_OneStep with a real-time clock or interrupt service routine
|
||||||
|
// is what makes the generated code "real-time". The function rt_OneStep is
|
||||||
|
// always associated with the base rate of the model. Subrates are managed
|
||||||
|
// by the base rate from inside the generated code. Enabling/disabling
|
||||||
|
// interrupts and floating point context switches are target specific. This
|
||||||
|
// example code indicates where these should take place relative to executing
|
||||||
|
// the generated code step function. Overrun behavior should be tailored to
|
||||||
|
// your application needs. This example simply sets an error status in the
|
||||||
|
// real-time model and returns from rt_OneStep.
|
||||||
|
//
|
||||||
|
void rt_OneStep(void);
|
||||||
|
void rt_OneStep(void)
|
||||||
|
{
|
||||||
|
static boolean_T OverrunFlag = false;
|
||||||
|
|
||||||
|
// Disable interrupts here
|
||||||
|
|
||||||
|
// Check for overrun
|
||||||
|
if (OverrunFlag) {
|
||||||
|
rtmSetErrorStatus(FSMTreppe_Obj.getRTM(), "Overrun");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverrunFlag = true;
|
||||||
|
|
||||||
|
// Save FPU context here (if necessary)
|
||||||
|
// Re-enable timer or interrupt here
|
||||||
|
// Set model inputs here
|
||||||
|
|
||||||
|
// Step the model
|
||||||
|
FSMTreppe_Obj.step();
|
||||||
|
|
||||||
|
// Get model outputs here
|
||||||
|
|
||||||
|
// Indicate task complete
|
||||||
|
OverrunFlag = false;
|
||||||
|
|
||||||
|
// Disable interrupts here
|
||||||
|
// Restore FPU context here (if necessary)
|
||||||
|
// Enable interrupts here
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// The example "main" function illustrates what is required by your
|
||||||
|
// application code to initialize, execute, and terminate the generated code.
|
||||||
|
// Attaching rt_OneStep to a real-time clock is target specific. This example
|
||||||
|
// illustrates how you do this relative to initializing the model.
|
||||||
|
//
|
||||||
|
int_T main(int_T argc, const char *argv[])
|
||||||
|
{
|
||||||
|
// Unused arguments
|
||||||
|
(void)(argc);
|
||||||
|
(void)(argv);
|
||||||
|
|
||||||
|
// Initialize model
|
||||||
|
FSMTreppe_Obj.initialize();
|
||||||
|
|
||||||
|
// Attach rt_OneStep to a timer or interrupt service routine with
|
||||||
|
// period 0.01 seconds (the model's base sample time) here. The
|
||||||
|
// call syntax for rt_OneStep is
|
||||||
|
//
|
||||||
|
// rt_OneStep();
|
||||||
|
|
||||||
|
printf("Warning: The simulation will run forever. "
|
||||||
|
"Generated ERT main won't simulate model step behavior. "
|
||||||
|
"To change this behavior select the 'MAT-file logging' option.\n");
|
||||||
|
fflush((NULL));
|
||||||
|
while (rtmGetErrorStatus(FSMTreppe_Obj.getRTM()) == (NULL)) {
|
||||||
|
// Perform other application tasks here
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable rt_OneStep() here
|
||||||
|
|
||||||
|
// Terminate model
|
||||||
|
FSMTreppe_Obj.terminate();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// File trailer for generated code.
|
||||||
|
//
|
||||||
|
// [EOF]
|
||||||
|
//
|
||||||
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/make_exception.mat
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/make_exception.mat
Normal file
Binary file not shown.
2
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/modelsources.txt
Normal file
2
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/modelsources.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FSMTreppe.cpp
|
||||||
|
|
||||||
4
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/rtw_proj.tmw
Normal file
4
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/rtw_proj.tmw
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Simulink Coder project for FSMTreppe using . MATLAB root = C:\Program Files\MATLAB\R2021a. SimStruct date: 15-Nov-2020 02:10:14
|
||||||
|
This file is generated by Simulink Coder for use by the make utility
|
||||||
|
to determine when to rebuild objects when the name of the current Simulink Coder project changes.
|
||||||
|
The rtwinfomat located at: ..\slprj\ert\FSMTreppe\tmwinternal\binfo.mat
|
||||||
160
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/rtwtypes.h
Normal file
160
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/rtwtypes.h
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
//
|
||||||
|
// 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: rtwtypes.h
|
||||||
|
//
|
||||||
|
// Code generated for Simulink model 'FSMTreppe'.
|
||||||
|
//
|
||||||
|
// Model version : 1.65
|
||||||
|
// Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
|
||||||
|
// C/C++ source code generated on : Tue Sep 7 08:47:00 2021
|
||||||
|
//
|
||||||
|
// Target selection: ert.tlc
|
||||||
|
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||||
|
// Code generation objectives: Unspecified
|
||||||
|
// Validation result: Not run
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef RTWTYPES_H
|
||||||
|
#define RTWTYPES_H
|
||||||
|
|
||||||
|
// Logical type definitions
|
||||||
|
#if (!defined(__cplusplus))
|
||||||
|
#ifndef false
|
||||||
|
#define false (0U)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef true
|
||||||
|
#define true (1U)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//=======================================================================*
|
||||||
|
// Target hardware information
|
||||||
|
// Device type: ARM Compatible->ARM Cortex-M
|
||||||
|
// Number of bits: char: 8 short: 16 int: 32
|
||||||
|
// long: 32
|
||||||
|
// native word size: 32
|
||||||
|
// Byte ordering: LittleEndian
|
||||||
|
// Signed integer division rounds to: Zero
|
||||||
|
// Shift right on a signed integer as arithmetic shift: on
|
||||||
|
// =======================================================================
|
||||||
|
|
||||||
|
//=======================================================================*
|
||||||
|
// Fixed width word size data types: *
|
||||||
|
// int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers *
|
||||||
|
// uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers *
|
||||||
|
// real32_T, real64_T - 32 and 64 bit floating point numbers *
|
||||||
|
// =======================================================================
|
||||||
|
typedef signed char int8_T;
|
||||||
|
typedef unsigned char uint8_T;
|
||||||
|
typedef short int16_T;
|
||||||
|
typedef unsigned short uint16_T;
|
||||||
|
typedef int int32_T;
|
||||||
|
typedef unsigned int uint32_T;
|
||||||
|
typedef float real32_T;
|
||||||
|
typedef double real64_T;
|
||||||
|
|
||||||
|
//===========================================================================*
|
||||||
|
// Generic type definitions: boolean_T, char_T, byte_T, int_T, uint_T, *
|
||||||
|
// real_T, time_T, ulong_T. *
|
||||||
|
// ===========================================================================
|
||||||
|
typedef double real_T;
|
||||||
|
typedef double time_T;
|
||||||
|
typedef unsigned char boolean_T;
|
||||||
|
typedef int int_T;
|
||||||
|
typedef unsigned int uint_T;
|
||||||
|
typedef unsigned long ulong_T;
|
||||||
|
typedef char char_T;
|
||||||
|
typedef unsigned char uchar_T;
|
||||||
|
typedef char_T byte_T;
|
||||||
|
|
||||||
|
//===========================================================================*
|
||||||
|
// Complex number type definitions *
|
||||||
|
// ===========================================================================
|
||||||
|
#define CREAL_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
real32_T re;
|
||||||
|
real32_T im;
|
||||||
|
} creal32_T;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
real64_T re;
|
||||||
|
real64_T im;
|
||||||
|
} creal64_T;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
real_T re;
|
||||||
|
real_T im;
|
||||||
|
} creal_T;
|
||||||
|
|
||||||
|
#define CINT8_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int8_T re;
|
||||||
|
int8_T im;
|
||||||
|
} cint8_T;
|
||||||
|
|
||||||
|
#define CUINT8_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_T re;
|
||||||
|
uint8_T im;
|
||||||
|
} cuint8_T;
|
||||||
|
|
||||||
|
#define CINT16_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int16_T re;
|
||||||
|
int16_T im;
|
||||||
|
} cint16_T;
|
||||||
|
|
||||||
|
#define CUINT16_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_T re;
|
||||||
|
uint16_T im;
|
||||||
|
} cuint16_T;
|
||||||
|
|
||||||
|
#define CINT32_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_T re;
|
||||||
|
int32_T im;
|
||||||
|
} cint32_T;
|
||||||
|
|
||||||
|
#define CUINT32_T
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_T re;
|
||||||
|
uint32_T im;
|
||||||
|
} cuint32_T;
|
||||||
|
|
||||||
|
//=======================================================================*
|
||||||
|
// Min and Max: *
|
||||||
|
// int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers *
|
||||||
|
// uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers *
|
||||||
|
// =======================================================================
|
||||||
|
#define MAX_int8_T ((int8_T)(127))
|
||||||
|
#define MIN_int8_T ((int8_T)(-128))
|
||||||
|
#define MAX_uint8_T ((uint8_T)(255U))
|
||||||
|
#define MAX_int16_T ((int16_T)(32767))
|
||||||
|
#define MIN_int16_T ((int16_T)(-32768))
|
||||||
|
#define MAX_uint16_T ((uint16_T)(65535U))
|
||||||
|
#define MAX_int32_T ((int32_T)(2147483647))
|
||||||
|
#define MIN_int32_T ((int32_T)(-2147483647-1))
|
||||||
|
#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU))
|
||||||
|
|
||||||
|
// Block D-Work pointer type
|
||||||
|
typedef void * pointer_T;
|
||||||
|
|
||||||
|
#endif // RTWTYPES_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// File trailer for generated code.
|
||||||
|
//
|
||||||
|
// [EOF]
|
||||||
|
//
|
||||||
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/rtwtypeschksum.mat
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/rtwtypeschksum.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/tmwinternal/tr
Normal file
BIN
lib/treppe/MatLabSrc/FSMTreppe_ert_rtw/tmwinternal/tr
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/FSM_Treppenlicht.slx
Normal file
BIN
lib/treppe/MatLabSrc/FSM_Treppenlicht.slx
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/jitEngineAccessInfo.mat
Normal file
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/jitEngineAccessInfo.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/s62r8ORs8TiuwKiY4lPlaeC.l
Normal file
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/s62r8ORs8TiuwKiY4lPlaeC.l
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/s62r8ORs8TiuwKiY4lPlaeC.mat
Normal file
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/s62r8ORs8TiuwKiY4lPlaeC.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/sTGUi98rQlfFIIKcc1lBYo.l
Normal file
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/sTGUi98rQlfFIIKcc1lBYo.l
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/sTGUi98rQlfFIIKcc1lBYo.mat
Normal file
BIN
lib/treppe/MatLabSrc/slprj/_jitprj/sTGUi98rQlfFIIKcc1lBYo.mat
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,49 @@
|
|||||||
|
%implements "machineSource" "C"
|
||||||
|
%function CacheMachineDefinitions(block,system) void
|
||||||
|
%openfile tmpFcnBuf
|
||||||
|
%closefile tmpFcnBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_data_defn",tmpFcnBuf)>\
|
||||||
|
|
||||||
|
%endfunction
|
||||||
|
%function DumpMachineInitializer(block) Output
|
||||||
|
|
||||||
|
%openfile tmpFcnBuf
|
||||||
|
|
||||||
|
%closefile tmpFcnBuf
|
||||||
|
%if !WHITE_SPACE(tmpFcnBuf)
|
||||||
|
|
||||||
|
/* Machine initializer */
|
||||||
|
%<tmpFcnBuf>\
|
||||||
|
%endif
|
||||||
|
%endfunction
|
||||||
|
%function GlobalMachineInitializer(block) void
|
||||||
|
%openfile tmpFcnBuf
|
||||||
|
%<DumpMachineInitializer(block)>\
|
||||||
|
%closefile tmpFcnBuf
|
||||||
|
%return tmpFcnBuf
|
||||||
|
%endfunction %% GlobalMachineInitializer
|
||||||
|
|
||||||
|
%function DumpMachineTerminator(block) Output
|
||||||
|
%openfile tmpFcnBuf
|
||||||
|
|
||||||
|
%closefile tmpFcnBuf
|
||||||
|
%if !WHITE_SPACE(tmpFcnBuf)
|
||||||
|
|
||||||
|
/* Machine initializer */
|
||||||
|
%<tmpFcnBuf>\
|
||||||
|
%endif
|
||||||
|
%endfunction
|
||||||
|
%function GlobalMachineTerminator(block) void
|
||||||
|
%openfile tmpFcnBuf
|
||||||
|
%<DumpMachineTerminator(block)>\
|
||||||
|
%closefile tmpFcnBuf
|
||||||
|
%return tmpFcnBuf
|
||||||
|
%endfunction %% GlobalMachineTerminator
|
||||||
|
|
||||||
|
%function CacheMachineFunctions(block,system) void
|
||||||
|
%openfile tmpFcnBuf
|
||||||
|
|
||||||
|
|
||||||
|
%closefile tmpFcnBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_fcn_defn",tmpFcnBuf)>
|
||||||
|
%endfunction
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
%implements "machineHeader" "C"
|
||||||
|
%function CacheOutputs(block,system) void
|
||||||
|
%assign srcFileName = SLibGetFullFileNameForSystemCode("sys_src_incl", system.SystemIdx)
|
||||||
|
%openfile typedefsBuf
|
||||||
|
|
||||||
|
%closefile typedefsBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_typedef",typedefsBuf)>
|
||||||
|
%if !WHITE_SPACE(typedefsBuf)
|
||||||
|
%<SLibUpdateHeadersNeededByFile(srcFileName, SLibGetFullFileNameForCode("sf_machine_typedef"))>
|
||||||
|
%endif
|
||||||
|
%openfile definesBuf
|
||||||
|
%closefile definesBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_data_define",definesBuf)>
|
||||||
|
%if !WHITE_SPACE(definesBuf)
|
||||||
|
%<SLibUpdateHeadersNeededByFile(srcFileName, SLibGetFullFileNameForCode("sf_machine_data_define"))>
|
||||||
|
%endif
|
||||||
|
%openfile externDataBuf
|
||||||
|
%closefile externDataBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_extern_data_decl",externDataBuf)>
|
||||||
|
%if !WHITE_SPACE(externDataBuf)
|
||||||
|
%<SLibUpdateHeadersNeededByFile(srcFileName, SLibGetFullFileNameForCode("sf_machine_extern_data_decl"))>
|
||||||
|
%endif
|
||||||
|
%openfile externDataBuf
|
||||||
|
%closefile externDataBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_public_extern_data_decl",externDataBuf)>
|
||||||
|
%if !WHITE_SPACE(externDataBuf)
|
||||||
|
%<SLibUpdateHeadersNeededByFile(srcFileName, SLibGetFullFileNameForCode("sf_machine_public_extern_data_decl"))>
|
||||||
|
%endif
|
||||||
|
%openfile externDataBuf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%closefile externDataBuf
|
||||||
|
%<SLibCacheCodeToFile("sf_machine_extern_fcn_decl",externDataBuf)>
|
||||||
|
%if !WHITE_SPACE(externDataBuf)
|
||||||
|
%<SLibUpdateHeadersNeededByFile(srcFileName, SLibGetFullFileNameForCode("sf_machine_extern_fcn_decl"))>
|
||||||
|
%endif
|
||||||
|
%endfunction %% CacheOutputs
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
%implements "chartSource" "C"
|
||||||
|
%function ChartConfig(block, system) void
|
||||||
|
%createrecord chartConfiguration { ...
|
||||||
|
executeAtInitialization 0 ...
|
||||||
|
}
|
||||||
|
%return chartConfiguration
|
||||||
|
%endfunction
|
||||||
|
%function ChartDataMap(block, system) void
|
||||||
|
%createrecord ChartDataElements {\
|
||||||
|
NumChartData 3 \
|
||||||
|
ChartDataDefaults {\
|
||||||
|
RecordType "ChartData"\
|
||||||
|
Dimensions []\
|
||||||
|
IsTestPoint 0\
|
||||||
|
}\
|
||||||
|
ChartData {\
|
||||||
|
Name "is_active_c3_FSMTreppe"\
|
||||||
|
Description "StateIsActive"\
|
||||||
|
SFName ""\
|
||||||
|
Path ""\
|
||||||
|
SrcLocation ""\
|
||||||
|
}\
|
||||||
|
ChartData {\
|
||||||
|
Name "is_c3_FSMTreppe"\
|
||||||
|
Description "StateActiveChild"\
|
||||||
|
SFName ""\
|
||||||
|
Path ""\
|
||||||
|
SrcLocation ""\
|
||||||
|
}\
|
||||||
|
ChartData {\
|
||||||
|
Name "temporalCounter_i1"\
|
||||||
|
Description "TemporalCounter"\
|
||||||
|
SFName ""\
|
||||||
|
Path ""\
|
||||||
|
SrcLocation ""\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
%return ChartDataElements
|
||||||
|
%endfunction
|
||||||
@ -0,0 +1 @@
|
|||||||
|
|
||||||
BIN
lib/treppe/MatLabSrc/slprj/_sfprj/FSMTreppe/amsi_serial.mat
Normal file
BIN
lib/treppe/MatLabSrc/slprj/_sfprj/FSMTreppe/amsi_serial.mat
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,369 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<MF0 version="1.1" packageUris="http://schema.mathworks.com/mf0/ci/19700101 http://schema.mathworks.com/mf0/sl_modelref_info/R2021a http://schema.mathworks.com/mf0/slexec_mm_sto/R2021a_202007071525">
|
||||||
|
<ModelRefInfoRepo.ModelRefInfoRoot type="ModelRefInfoRepo.ModelRefInfoRoot" uuid="8c91d049-4f97-4bab-9878-75249f9e4ce5">
|
||||||
|
<autoSolverStatusFlags>327</autoSolverStatusFlags>
|
||||||
|
<childModelRefInfo type="ModelRefInfoRepo.ChildModelRefInfo" uuid="a6d6d289-18e5-4e3a-a084-25aa29dfde4c">
|
||||||
|
<modelName>FSMTreppe</modelName>
|
||||||
|
<modelPath>FSMTreppe</modelPath>
|
||||||
|
</childModelRefInfo>
|
||||||
|
<dataTransferInfos>AAFJTQAAAAAOAAAAOAAAAAYAAAAIAAAAAgAAAAAAAAAFAAAACAAAAAAAAAABAAAAAQAAAAAAAAAFAAQAAQAAAAEAAAAAAAAA</dataTransferInfos>
|
||||||
|
<fundamentalSampleTimePeriod>.01</fundamentalSampleTimePeriod>
|
||||||
|
<hasBlockWithPeriodicDiscreteSampleTime>true</hasBlockWithPeriodicDiscreteSampleTime>
|
||||||
|
<hasBwsAccessed>true</hasBwsAccessed>
|
||||||
|
<hasBwsAccessedByAnyModel>true</hasBwsAccessedByAnyModel>
|
||||||
|
<hasStatesModifiedInOutputUpdate>true</hasStatesModifiedInOutputUpdate>
|
||||||
|
<inports type="ModelRefInfoRepo.InportInformation" uuid="3dc97546-0910-427f-9bc7-9e91fec18867">
|
||||||
|
<isNotDerivPort>true</isNotDerivPort>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<indexType>2</indexType>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="9cd81293-70da-4c16-8844-138377fd2ffa"/>
|
||||||
|
</inports>
|
||||||
|
<inports type="ModelRefInfoRepo.InportInformation" uuid="f73563dc-9c8d-4480-99e9-2c0b052edfc9">
|
||||||
|
<isNotDerivPort>true</isNotDerivPort>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<indexType>2</indexType>
|
||||||
|
<originalPortNumber>1</originalPortNumber>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="98c95bd5-dcdd-41dd-87c0-d47532b36c10"/>
|
||||||
|
</inports>
|
||||||
|
<inports type="ModelRefInfoRepo.InportInformation" uuid="2034510f-ecff-4ad3-b7a1-bd08f645356b">
|
||||||
|
<isNotDerivPort>true</isNotDerivPort>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<indexType>2</indexType>
|
||||||
|
<originalPortNumber>2</originalPortNumber>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="cd2922c2-d42f-4799-aeec-e36598671a09"/>
|
||||||
|
</inports>
|
||||||
|
<inports type="ModelRefInfoRepo.InportInformation" uuid="cc6453dd-0d6b-44c7-ae81-7ae9ea6fee69">
|
||||||
|
<isNotDerivPort>true</isNotDerivPort>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<indexType>2</indexType>
|
||||||
|
<originalPortNumber>3</originalPortNumber>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="b541c213-306d-4f84-a877-ad3423724d21"/>
|
||||||
|
</inports>
|
||||||
|
<inports type="ModelRefInfoRepo.InportInformation" uuid="bd911fe8-045d-4191-ba64-990a9b0baba8">
|
||||||
|
<isNotDerivPort>true</isNotDerivPort>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<indexType>2</indexType>
|
||||||
|
<originalPortNumber>4</originalPortNumber>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="9282f124-0226-4425-9c6a-8fbc484d8f62"/>
|
||||||
|
</inports>
|
||||||
|
<isBdInSimModeForSimCodegenVariants>false</isBdInSimModeForSimCodegenVariants>
|
||||||
|
<isInlineParamsOn>true</isInlineParamsOn>
|
||||||
|
<isOrigInportVirtualBus>false</isOrigInportVirtualBus>
|
||||||
|
<isOrigInportVirtualBus>false</isOrigInportVirtualBus>
|
||||||
|
<isOrigInportVirtualBus>false</isOrigInportVirtualBus>
|
||||||
|
<isOrigInportVirtualBus>false</isOrigInportVirtualBus>
|
||||||
|
<isOrigInportVirtualBus>false</isOrigInportVirtualBus>
|
||||||
|
<isOrigOutportVirtualBus>false</isOrigOutportVirtualBus>
|
||||||
|
<isOrigOutportVirtualBus>false</isOrigOutportVirtualBus>
|
||||||
|
<isOrigOutportVirtualBus>false</isOrigOutportVirtualBus>
|
||||||
|
<loggingSaveFormat>2</loggingSaveFormat>
|
||||||
|
<maxFreqHz>-1.0</maxFreqHz>
|
||||||
|
<numDataInputPorts>5</numDataInputPorts>
|
||||||
|
<numLoggableJacobianDStates>0</numLoggableJacobianDStates>
|
||||||
|
<origInportBusType></origInportBusType>
|
||||||
|
<origInportBusType></origInportBusType>
|
||||||
|
<origInportBusType></origInportBusType>
|
||||||
|
<origInportBusType></origInportBusType>
|
||||||
|
<origInportBusType></origInportBusType>
|
||||||
|
<origOutportBusOutputAsStruct>false</origOutportBusOutputAsStruct>
|
||||||
|
<origOutportBusOutputAsStruct>false</origOutportBusOutputAsStruct>
|
||||||
|
<origOutportBusOutputAsStruct>false</origOutportBusOutputAsStruct>
|
||||||
|
<origOutportBusType></origOutportBusType>
|
||||||
|
<origOutportBusType></origOutportBusType>
|
||||||
|
<origOutportBusType></origOutportBusType>
|
||||||
|
<outports type="ModelRefInfoRepo.OutportInformation" uuid="730188ea-a135-4ebe-90bf-6d86de487f40">
|
||||||
|
<hasSystemInitMethod>true</hasSystemInitMethod>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="022f3f70-d650-4c09-b92e-a82eae70cca0"/>
|
||||||
|
</outports>
|
||||||
|
<outports type="ModelRefInfoRepo.OutportInformation" uuid="a4bd5e44-5daa-439d-9fcd-074b1f23791b">
|
||||||
|
<hasSystemInitMethod>true</hasSystemInitMethod>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<originalPortNumber>1</originalPortNumber>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="9a85f83a-af2f-4a8b-8b39-f87903bab9e3"/>
|
||||||
|
</outports>
|
||||||
|
<outports type="ModelRefInfoRepo.OutportInformation" uuid="b045b60e-3dae-4adc-990e-4bb63a007aa3">
|
||||||
|
<hasSystemInitMethod>true</hasSystemInitMethod>
|
||||||
|
<designMax>Inf</designMax>
|
||||||
|
<designMin>-Inf</designMin>
|
||||||
|
<originalPortNumber>2</originalPortNumber>
|
||||||
|
<rateInfo type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</rateInfo>
|
||||||
|
<resolvedSignalObject></resolvedSignalObject>
|
||||||
|
<sigNameToEMVCEMap type="ModelRefInfoRepo.SigNameEMVCEInfo" uuid="c528ad7d-8ccf-4847-9b02-7492d282a463"/>
|
||||||
|
</outports>
|
||||||
|
<removeResetFunc>true</removeResetFunc>
|
||||||
|
<runtimeNonFcnCallRateInfos type="ModelRefInfoRepo.RateInfo">
|
||||||
|
<compiled>true</compiled>
|
||||||
|
<nonFcnCallPartitionName>D1</nonFcnCallPartitionName>
|
||||||
|
<period>.01</period>
|
||||||
|
<priority>40</priority>
|
||||||
|
<rateIdx>0</rateIdx>
|
||||||
|
</runtimeNonFcnCallRateInfos>
|
||||||
|
<sampleTimeInheritanceRule>2</sampleTimeInheritanceRule>
|
||||||
|
<timingAndTaskingRegistry><?xml version="1.0"?>
|
||||||
|
<slexec_sto version="1.1" packageUris="http://schema.mathworks.com/mf0/slexec_mm_sto/R2021a_202007071525">
|
||||||
|
<sto.Registry type="sto.Registry" uuid="9b7d34e5-9d96-44f0-b2a3-9f989daf3c92">
|
||||||
|
<clocks type="sto.Timer" uuid="626dfc1a-2af1-4bf4-b453-3f3a1fda66c1">
|
||||||
|
<computedFundamentalDiscretePeriod>.01</computedFundamentalDiscretePeriod>
|
||||||
|
<resolution>.01</resolution>
|
||||||
|
<clockTickConstraint>PeriodicWithFixedResolution</clockTickConstraint>
|
||||||
|
<specifiedTaskingMode>ClassicMultiTasking</specifiedTaskingMode>
|
||||||
|
<timeAdvanceMode>FixedStep</timeAdvanceMode>
|
||||||
|
<clockDomain type="sto.ClockDomain" uuid="e7bc3f67-5218-4c0d-9dea-3c07a32eafc4">
|
||||||
|
<baseTaskID>_task0</baseTaskID>
|
||||||
|
<rates type="sto.Rate" uuid="d4495b93-a61c-4a6a-81c8-0f9b18a67d05"/>
|
||||||
|
<rootTaskHierarchyElements type="sto.Task" uuid="5a391a5c-a43d-4aa9-bc41-2a93663da7b2">
|
||||||
|
<isExecutable>true</isExecutable>
|
||||||
|
<orderIndex>1</orderIndex>
|
||||||
|
<rates type="sto.Rate" uuid="d4495b93-a61c-4a6a-81c8-0f9b18a67d05">
|
||||||
|
<annotation>D1</annotation>
|
||||||
|
<colorIndex>2</colorIndex>
|
||||||
|
<description>Discrete 1</description>
|
||||||
|
<eventSourceType>UNSPECIFIED_EVENT_SOURCE</eventSourceType>
|
||||||
|
<registry type="sto.Registry" uuid="9b7d34e5-9d96-44f0-b2a3-9f989daf3c92"/>
|
||||||
|
<taskId>_task0</taskId>
|
||||||
|
<rateSpec type="sto.RateSpec" uuid="ae5af4bd-9e1d-4b56-893c-68e4b2480f8d">
|
||||||
|
<period>.01</period>
|
||||||
|
<rateType>ClassicPeriodicDiscrete</rateType>
|
||||||
|
</rateSpec>
|
||||||
|
</rates>
|
||||||
|
<elementType>Task</elementType>
|
||||||
|
<identifier>_task0</identifier>
|
||||||
|
<priority>40</priority>
|
||||||
|
</rootTaskHierarchyElements>
|
||||||
|
</clockDomain>
|
||||||
|
</clocks>
|
||||||
|
<executionSpec>Undetermined</executionSpec>
|
||||||
|
<taskDependencyGraph type="sto.SerializedTaskConnectionList" uuid="f3e9c73b-bb20-4ef6-a737-eff2b3a03780">
|
||||||
|
<taskIdentifier>_task0</taskIdentifier>
|
||||||
|
</taskDependencyGraph>
|
||||||
|
<taskPriorityDirection>HighNumberLast</taskPriorityDirection>
|
||||||
|
<taskingMode>ClassicMultiTasking</taskingMode>
|
||||||
|
<tasks type="sto.Task" uuid="5a391a5c-a43d-4aa9-bc41-2a93663da7b2"/>
|
||||||
|
<timeAdvanceMode>FixedStep</timeAdvanceMode>
|
||||||
|
</sto.Registry>
|
||||||
|
</slexec_sto></timingAndTaskingRegistry>
|
||||||
|
<zeroInternalMemoryAtStartupUnchecked>true</zeroInternalMemoryAtStartupUnchecked>
|
||||||
|
<FMUBlockMap type="ModelRefInfoRepo.FMUBlockInfo" uuid="b93b26b0-22f0-4764-a798-053907f178f4"/>
|
||||||
|
<codeGenInfo type="ModelRefInfoRepo.CodeGenInformation" uuid="d598be23-3911-4922-9ca1-b6dca592cdf8"/>
|
||||||
|
<configSettingsForConsistencyChecks type="ModelRefInfoRepo.ConfigSettingsForConsistencyChecks" uuid="79532f7e-333b-46dc-830a-de1e37104a81">
|
||||||
|
<consistentOutportInitialization>true</consistentOutportInitialization>
|
||||||
|
<fixedStepSize>.01</fixedStepSize>
|
||||||
|
<hasHybridSampleTime>true</hasHybridSampleTime>
|
||||||
|
<optimizedInitCode>true</optimizedInitCode>
|
||||||
|
<signalLoggingSaveFormat>2</signalLoggingSaveFormat>
|
||||||
|
<simSIMDOptimization>1</simSIMDOptimization>
|
||||||
|
<solverName>FixedStepDiscrete</solverName>
|
||||||
|
<solverType>SOLVER_TYPE_FIXEDSTEP</solverType>
|
||||||
|
<hardwareSettings type="ModelRefInfoRepo.HardwareSettings" uuid="69f559cc-e983-4421-8260-4b0ab3d57945">
|
||||||
|
<prodBitPerChar>8</prodBitPerChar>
|
||||||
|
<prodBitPerDouble>64</prodBitPerDouble>
|
||||||
|
<prodBitPerFloat>32</prodBitPerFloat>
|
||||||
|
<prodBitPerInt>32</prodBitPerInt>
|
||||||
|
<prodBitPerLong>32</prodBitPerLong>
|
||||||
|
<prodBitPerLongLong>64</prodBitPerLongLong>
|
||||||
|
<prodBitPerPointer>32</prodBitPerPointer>
|
||||||
|
<prodBitPerPtrDiffT>32</prodBitPerPtrDiffT>
|
||||||
|
<prodBitPerShort>16</prodBitPerShort>
|
||||||
|
<prodBitPerSizeT>32</prodBitPerSizeT>
|
||||||
|
<prodEndianess>1</prodEndianess>
|
||||||
|
<prodLargestAtomicFloat>1</prodLargestAtomicFloat>
|
||||||
|
<prodLargestAtomicInteger>3</prodLargestAtomicInteger>
|
||||||
|
<prodShiftRight>true</prodShiftRight>
|
||||||
|
<prodWordSize>32</prodWordSize>
|
||||||
|
</hardwareSettings>
|
||||||
|
</configSettingsForConsistencyChecks>
|
||||||
|
<controllableInputRatesMap type="ModelRefInfoRepo.VarTsUIDMap" uuid="188fca95-6ffa-4497-91c4-097c5c5aee33"/>
|
||||||
|
<controllableOutputRatesMap type="ModelRefInfoRepo.VarTsUIDMap" uuid="34d898ee-0488-42bb-be25-40cbd6819eaf"/>
|
||||||
|
<dataPortGroup type="ModelRefInfoRepo.DataPortGroup" uuid="99ea55ca-19b6-439c-b494-ab33265aa22b">
|
||||||
|
<compDataInputPorts>0</compDataInputPorts>
|
||||||
|
<compDataInputPorts>1</compDataInputPorts>
|
||||||
|
<compDataInputPorts>2</compDataInputPorts>
|
||||||
|
<compDataInputPorts>3</compDataInputPorts>
|
||||||
|
<compDataInputPorts>4</compDataInputPorts>
|
||||||
|
<compDataOutputPorts>0</compDataOutputPorts>
|
||||||
|
<compDataOutputPorts>1</compDataOutputPorts>
|
||||||
|
<compDataOutputPorts>2</compDataOutputPorts>
|
||||||
|
<dataInputPorts>0</dataInputPorts>
|
||||||
|
<dataInputPorts>1</dataInputPorts>
|
||||||
|
<dataInputPorts>2</dataInputPorts>
|
||||||
|
<dataInputPorts>3</dataInputPorts>
|
||||||
|
<dataInputPorts>4</dataInputPorts>
|
||||||
|
<dataOutputPorts>0</dataOutputPorts>
|
||||||
|
<dataOutputPorts>1</dataOutputPorts>
|
||||||
|
<dataOutputPorts>2</dataOutputPorts>
|
||||||
|
</dataPortGroup>
|
||||||
|
<expFcnUnconnectedDataPortGroup type="ModelRefInfoRepo.DataPortGroup" uuid="9857c752-3ac8-4e50-8860-b306bd783dd4"/>
|
||||||
|
<interfaceParameterInfo type="ModelRefInfoRepo.InterfaceParameterInfo" uuid="e1381a12-d132-4b2a-8837-635f4863a9c2"/>
|
||||||
|
<messageInfo type="ModelRefInfoRepo.MessageInformation" uuid="d14ba5d4-7085-4560-87a6-b9de7a83fb36"/>
|
||||||
|
<methodInfo type="ModelRefInfoRepo.MethodExistenceInfo" uuid="d88c6655-e78d-4745-93e1-9f8837d13b0b">
|
||||||
|
<hasEnableMethod>true</hasEnableMethod>
|
||||||
|
<hasSystemInitializeMethod>true</hasSystemInitializeMethod>
|
||||||
|
<hasSystemResetMethod>true</hasSystemResetMethod>
|
||||||
|
<hasTerminateMethod>true</hasTerminateMethod>
|
||||||
|
</methodInfo>
|
||||||
|
<periodicEventPortUnsupportedBlockInfo type="ModelRefInfoRepo.PeriodicEventPortUnsupportedBlockInfo" uuid="f61487e4-ebaf-4b99-9d2b-c4b1ea41af92"/>
|
||||||
|
<portGroupsRequireSameRate type="ModelRefInfoRepo.PortGroupsRequireSameRate" uuid="79702c85-5b35-40f3-ae57-7023f221a663">
|
||||||
|
<DSMPortGroups type="ModelRefInfoRepo.NameToPortGroupIdxVectMap" uuid="6de7bfcb-0451-406e-8e38-16e7fe1c75a6"/>
|
||||||
|
<GlobalDSMPortGroups type="ModelRefInfoRepo.NameToPortGroupIdxVectMap" uuid="6f27c871-22fc-4c10-8f4d-1d41d46055ee"/>
|
||||||
|
<mergedPortGroups type="ModelRefInfoRepo.NameToPortGroupIdxVectMap" uuid="5d9254a5-a2a4-4a98-9aef-3308701c81f0"/>
|
||||||
|
</portGroupsRequireSameRate>
|
||||||
|
<rateBasedMdlGlobalDSMRateSpec type="ModelRefInfoRepo.GlobalDSMRateSpecMap" uuid="a29995d7-52f1-4edd-aaef-698a2a68529b"/>
|
||||||
|
<rateSpecOfGlobalDSMAccessedByDescExpFcnMdlMap type="ModelRefInfoRepo.GlobalDSMRateSpecMap" uuid="45b11e5f-09ce-4444-be7c-9384c8ed3d75"/>
|
||||||
|
<rootBlockDiagramInterface type="ci.Model" uuid="25370f49-f80f-4984-a40b-a7f84df8f739">
|
||||||
|
<p_RootComponentInterface type="ci.ComponentInterface" uuid="70af63cd-69ac-460e-af61-b81475e3805e">
|
||||||
|
<p_InputPorts type="ci.SignalInterface" uuid="05356a46-76c9-496b-b870-a6606a2681b4">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_InputPorts>
|
||||||
|
<p_InputPorts type="ci.SignalInterface" uuid="65b4f285-1e30-435e-93ab-dd78ef98157e">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_InputPorts>
|
||||||
|
<p_InputPorts type="ci.SignalInterface" uuid="7af0a6c1-c38b-47c3-b02a-8930848add94">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_InputPorts>
|
||||||
|
<p_InputPorts type="ci.SignalInterface" uuid="6840ec21-0ff0-4091-9e69-78eafc35d6f5">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_InputPorts>
|
||||||
|
<p_InputPorts type="ci.SignalInterface" uuid="11187d0c-88fb-4a76-b6c1-8ae6af93ec59">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_InputPorts>
|
||||||
|
<p_Name>FSMTreppe</p_Name>
|
||||||
|
<p_OutputPorts type="ci.SignalInterface" uuid="a983c36b-3a44-48e2-95a5-3cf9884f8810">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_OutputPorts>
|
||||||
|
<p_OutputPorts type="ci.SignalInterface" uuid="f099e52b-3f98-4f3d-9a53-e5f41ee8bd93">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_OutputPorts>
|
||||||
|
<p_OutputPorts type="ci.SignalInterface" uuid="21fb1cab-f5bf-4b33-8280-97ca7bd77920">
|
||||||
|
<p_ComputedNumericDimensions>1.0</p_ComputedNumericDimensions>
|
||||||
|
<p_ComputedSampleTime>.01</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSampleTime>0.0</p_ComputedSampleTime>
|
||||||
|
<p_ComputedSymbolicDimensions>inherit</p_ComputedSymbolicDimensions>
|
||||||
|
<p_ComputedType>uint32</p_ComputedType>
|
||||||
|
</p_OutputPorts>
|
||||||
|
<p_Type>ROOT</p_Type>
|
||||||
|
</p_RootComponentInterface>
|
||||||
|
</rootBlockDiagramInterface>
|
||||||
|
<simulinkFunctions type="ModelRefInfoRepo.SimulinkFunctions" uuid="d5f398f3-db0d-4011-8e70-b49ab7ad1d2e">
|
||||||
|
<compSimulinkFunctionCatalog></compSimulinkFunctionCatalog>
|
||||||
|
</simulinkFunctions>
|
||||||
|
<stateWriterToOwnerMap type="ModelRefInfoRepo.StateWriterInfo" uuid="bd389837-c442-4b09-904b-968bdf13ec78"/>
|
||||||
|
<stoClientDataRegistry type="sto.ClientDataRegistry" uuid="b745f9d4-b391-4ce6-8b3b-ddfa4c1c3048">
|
||||||
|
<dataSets type="sto.ClientClockNamedDataSet" uuid="295512be-0378-4fde-8696-c3318b490c08">
|
||||||
|
<tag>sltpEvents</tag>
|
||||||
|
</dataSets>
|
||||||
|
<dataSets type="sto.ClientTaskHierarchyElementNamedDataSet" uuid="aee088fb-049d-4150-9f5f-88ba57760916">
|
||||||
|
<tag>sltpTaskGroups</tag>
|
||||||
|
</dataSets>
|
||||||
|
<dataSets type="sto.ClientTaskHierarchyElementNamedDataSet" uuid="26bbddc2-d033-4b56-bd42-4ebc47367e3f">
|
||||||
|
<dSet type="ModelRefInfoRepo.SltpTaskData" uuid="e04174da-4467-4c63-a2fe-3974591c9c06"/>
|
||||||
|
<tSet type="ModelRefInfoRepo.SltpTaskData" uuid="e04174da-4467-4c63-a2fe-3974591c9c06">
|
||||||
|
<dataName>D1</dataName>
|
||||||
|
<linkedSet type="sto.ClientTaskHierarchyElementNamedDataSet" uuid="26bbddc2-d033-4b56-bd42-4ebc47367e3f"/>
|
||||||
|
<id type="sto.TaskHierarchyElementId">
|
||||||
|
<id>_task0</id>
|
||||||
|
</id>
|
||||||
|
</tSet>
|
||||||
|
<tag>sltpTasks</tag>
|
||||||
|
</dataSets>
|
||||||
|
</stoClientDataRegistry>
|
||||||
|
<varTsUIDMap type="ModelRefInfoRepo.VarTsUIDMap" uuid="5509c4d8-513d-44e6-94d3-3b9fa42f55f1"/>
|
||||||
|
</ModelRefInfoRepo.ModelRefInfoRoot>
|
||||||
|
</MF0>
|
||||||
BIN
lib/treppe/MatLabSrc/slprj/ert/FSMTreppe/tmwinternal/binfo.mat
Normal file
BIN
lib/treppe/MatLabSrc/slprj/ert/FSMTreppe/tmwinternal/binfo.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/ert/FSMTreppe/tmwinternal/minfo.mat
Normal file
BIN
lib/treppe/MatLabSrc/slprj/ert/FSMTreppe/tmwinternal/minfo.mat
Normal file
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/ert/FSMTreppe/tmwinternal/scv
Normal file
BIN
lib/treppe/MatLabSrc/slprj/ert/FSMTreppe/tmwinternal/scv
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/treppe/MatLabSrc/slprj/ert/_sharedutils/shared_file.dmr
Normal file
BIN
lib/treppe/MatLabSrc/slprj/ert/_sharedutils/shared_file.dmr
Normal file
Binary file not shown.
2
lib/treppe/MatLabSrc/slprj/sl_proj.tmw
Normal file
2
lib/treppe/MatLabSrc/slprj/sl_proj.tmw
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Simulink Coder project marker file. Please don't change it.
|
||||||
|
slprjVersion: 10.3_086
|
||||||
@ -1,242 +1,463 @@
|
|||||||
#include "treppe.h"
|
#include "treppe.h"
|
||||||
|
// #define DEBUG_TIMING
|
||||||
|
|
||||||
uint8_t Treppe::softstart_led(uint8_t led, uint16_t startval, uint16_t stopval){
|
/*
|
||||||
/*
|
- dimmer_tick: increment pwm jeden tick, bis anim beendet
|
||||||
softstart task
|
- return: fsm_pend.anim_beendet
|
||||||
|
*/
|
||||||
|
bool Treppe::dimmer_tick(dimmer_t *dimmer, bool dim_type) {
|
||||||
|
dimmer->pwm += dimmer->delta_pwm;
|
||||||
|
|
||||||
- get's called at regular intervals (1ms at the moment)
|
#ifdef DIMMDEBUG
|
||||||
- dimms single led (0 - 15, PCA9685 outputs) with linear intervals vom startval to stopval
|
Serial.printf("%.0f", dimmer->pwm);
|
||||||
- calculates pwm steps depending on startval, stopval and timeinterval
|
#endif
|
||||||
- -> results in constanst speed
|
|
||||||
- returns 1 if led dimming is running
|
|
||||||
- returns 0 if led dimming is finished
|
|
||||||
|
|
||||||
*/
|
if (dim_type == DIM_STUFEN) {
|
||||||
|
pwmController.setChannelPWM(dimmer->stufe,
|
||||||
|
static_cast<uint16_t>(dimmer->pwm));
|
||||||
|
} else { // DIM_LDR
|
||||||
|
pwmController.setAllChannelsPWM(static_cast<uint16_t>(dimmer->pwm));
|
||||||
|
}
|
||||||
|
|
||||||
static uint8_t lastled = 255;
|
dimmer->tick++;
|
||||||
static float current_pwm = 0;
|
if (dimmer->tick < dimmer->ticks) {
|
||||||
static float stepsize = 1.0;
|
#ifdef DIMMDEBUG
|
||||||
if(led != lastled){
|
Serial.print("-");
|
||||||
pwmController.setChannelPWM(led, (uint16_t)startval);
|
#endif
|
||||||
lastled = led;
|
return false;
|
||||||
current_pwm = startval;
|
}
|
||||||
stepsize = INT_TIME*abs(stopval - startval)/(float)time_per_stair; // only valid at 1ms function call interval
|
#ifdef DIMMDEBUG
|
||||||
return 1;
|
Serial.println("");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (dim_type == DIM_LDR) {
|
||||||
|
Serial.printf("DIM_LDR: start: %d, ziel: %d\n", dimmer->start_pwm,
|
||||||
|
dimmer->ziel_pwm);
|
||||||
|
return true;
|
||||||
|
} else { // DIM_STUFEN
|
||||||
|
Serial.printf("DIM_STUFEN: stufe: %d, start: %d, ziel: %d\n",
|
||||||
|
dimmer->stufe, dimmer->start_pwm, dimmer->ziel_pwm);
|
||||||
|
|
||||||
|
if (fsm_outputs.laufrichtung == LR_HOCH) {
|
||||||
|
if (dimmer->stufe >= stufen - 1)
|
||||||
|
return true;
|
||||||
|
dimmer->stufe++;
|
||||||
|
} else { // LR_RUNTER
|
||||||
|
if (dimmer->stufe <= 0)
|
||||||
|
return true;
|
||||||
|
dimmer->stufe--;
|
||||||
}
|
}
|
||||||
|
dimmer->tick = 0;
|
||||||
if(startval > stopval){
|
dimmer->pwm = dimmer->start_pwm;
|
||||||
current_pwm -= stepsize;
|
}
|
||||||
}
|
return false;
|
||||||
else {
|
|
||||||
current_pwm += stepsize;
|
|
||||||
}
|
|
||||||
// Serial.println((uint16_t)current_pwm);
|
|
||||||
pwmController.setChannelPWM(led, (uint16_t)current_pwm);
|
|
||||||
if(current_pwm > stopval - stepsize && current_pwm < stopval + stepsize){
|
|
||||||
if(stopval == 0) pwmController.setChannelPWM(led, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Treppe::ledsequence(){
|
// startbedingunen für animation
|
||||||
static int8_t led = 0;
|
void Treppe::start_animation(dimmer_t *dimmer, bool dim_type, uint16_t on_pwm,
|
||||||
static uint16_t brightness = 0;
|
uint16_t off_pwm) {
|
||||||
static uint16_t lastbrightness = 0;
|
fsm_pend.anim_beendet = false;
|
||||||
static uint16_t status = 0;
|
|
||||||
uint16_t status_build = 0;
|
|
||||||
status_build |= direction << 8;
|
|
||||||
status_build |= state;
|
|
||||||
if(status_build != status){ // check if any parameter changed
|
|
||||||
finish = 0; // set state unfinished -> start action
|
|
||||||
if(direction) led = 0; // reset led counter depending of direction
|
|
||||||
else led = stairs-1;
|
|
||||||
if(state){
|
|
||||||
brightness = active_brightness; // set brightness value depending of on/off
|
|
||||||
lastbrightness = idle_brightness;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
brightness = idle_brightness;
|
|
||||||
lastbrightness = active_brightness;
|
|
||||||
}
|
|
||||||
status = status_build; // set parameter memory
|
|
||||||
|
|
||||||
Serial.printf("----Status Changed! onoff: %d, dir: %d\n", state, direction);
|
if (dim_type == DIM_STUFEN) {
|
||||||
}
|
if (fsm_outputs.laufrichtung == LR_HOCH)
|
||||||
if(!finish){ // finish == 0 -> action pending
|
dimmer->stufe = 0;
|
||||||
if(!softstart_led(led,lastbrightness, brightness)){
|
else
|
||||||
Serial.printf("one LED finished: led: %d, last: %d, curr %d\n",
|
dimmer->stufe = stufen - 1;
|
||||||
led, lastbrightness, brightness);
|
|
||||||
|
|
||||||
if(direction){
|
dimmer->ticks = param.time_per_stair / INT_TIME; // [ms]
|
||||||
led++;
|
} else { // DIM_LDR
|
||||||
if(led >= stairs)
|
dimmer->ticks = param.time_ldr / INT_TIME; // [ms]
|
||||||
finish = 1;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
led--;
|
|
||||||
if(led < 0)
|
|
||||||
finish = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Treppe::rampe()
|
|
||||||
{
|
|
||||||
if(state) {
|
|
||||||
finish = 0;
|
|
||||||
state = 0;// set parameter memory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!finish) {
|
if (fsm_outputs.dimmrichtung == DR_AUFDIMMEN) {
|
||||||
if(direction) { // aufwärts
|
dimmer->start_pwm = off_pwm;
|
||||||
if(tick >= ticks_treppe-1) { // ziel erreicht
|
dimmer->ziel_pwm = on_pwm;
|
||||||
Serial.println("[Treppe] oberster tick !");
|
dimmer->delta_pwm = (float)(on_pwm - off_pwm) / (float)dimmer->ticks;
|
||||||
finish = 1;
|
} else {
|
||||||
return;
|
dimmer->start_pwm = on_pwm;
|
||||||
}
|
dimmer->ziel_pwm = off_pwm;
|
||||||
tick++; // eins hoch
|
dimmer->delta_pwm = (float)(off_pwm - on_pwm) / (float)dimmer->ticks;
|
||||||
}
|
|
||||||
else { // abwärts
|
|
||||||
if(tick <= 0) { // ziel erreicht
|
|
||||||
Serial.println("[Treppe] unterster tick !");
|
|
||||||
finish = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tick--; // eins runter
|
|
||||||
}
|
|
||||||
|
|
||||||
stufe = tick / ticks_pro_stufe;
|
|
||||||
|
|
||||||
float new_pwm = 0.0;
|
|
||||||
if(an_aus) {
|
|
||||||
new_pwm = differenz_pwm_pro_tick * (tick - ticks_pro_stufe*stufe);
|
|
||||||
new_pwm += idle_brightness;
|
|
||||||
if(direction) new_pwm += differenz_pwm_pro_tick;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
new_pwm = active_brightness - differenz_pwm_pro_tick * (tick - ticks_pro_stufe*stufe);
|
|
||||||
new_pwm += idle_brightness;
|
|
||||||
if(direction) new_pwm -= differenz_pwm_pro_tick;
|
|
||||||
}
|
|
||||||
|
|
||||||
pwmController.setChannelPWM(stufe, (uint16_t) new_pwm);
|
|
||||||
Serial.printf("tick %04u, led %02d:%02u, pwm %4.1f\n",
|
|
||||||
tick,
|
|
||||||
stufe,
|
|
||||||
(tick - ticks_pro_stufe*stufe),
|
|
||||||
new_pwm
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Treppe::setup(){
|
dimmer->tick = 0;
|
||||||
|
dimmer->pwm = dimmer->start_pwm;
|
||||||
|
|
||||||
pwmController.resetDevices();
|
#ifndef LDR_REGELUNG
|
||||||
// Deactive PCA9685 Phase Balancer due to LED Flickering
|
idle_pwm_ist = param.idle_pwm_max;
|
||||||
// https://github.com/NachtRaveVL/PCA9685-Arduino/issues/15
|
#endif
|
||||||
// see also lib/PCA9685-Arduin/PCA9685.h:204
|
|
||||||
pwmController.init(PCA9685_PhaseBalancer_None);
|
|
||||||
//pwmController.init(PCA9685_PhaseBalancer_Linear);
|
|
||||||
pwmController.setPWMFrequency(100);
|
|
||||||
pwmController.setAllChannelsPWM(idle_brightness);
|
|
||||||
|
|
||||||
pinMode(A0, INPUT);
|
Serial.printf("stufe %d, ticks %d, delta %f, start %d, ziel %d\n",
|
||||||
pinMode(SENSOR_OBEN, INPUT);
|
dimmer->stufe, dimmer->ticks, dimmer->delta_pwm,
|
||||||
pinMode(SENSOR_UNTEN, INPUT);
|
dimmer->start_pwm, dimmer->ziel_pwm);
|
||||||
pinMode(OE, OUTPUT);
|
|
||||||
digitalWrite(OE, 0);
|
|
||||||
|
|
||||||
Serial.printf("differenz_pwm_pro_tick %f\n", differenz_pwm_pro_tick);
|
|
||||||
Serial.println("Hello from Treppe");
|
|
||||||
Serial.print("Treppe: initial parameters: stairs=");
|
|
||||||
Serial.println(stairs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Treppe::print_state_on_change() {
|
void Treppe::print_state_on_change() {
|
||||||
static FSMTreppeModelClass::ExtU_FSMTreppe_T last_in;
|
static FSMTreppeModelClass::ExtU_FSMTreppe_T last_in;
|
||||||
static FSMTreppeModelClass::ExtY_FSMTreppe_T last_out;
|
static FSMTreppeModelClass::ExtY_FSMTreppe_T last_out;
|
||||||
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_inputs.ldr_schwelle != last_in.ldr_schwelle ||
|
||||||
fsm_outputs.dimmrichtung != last_out.dimmrichtung ||
|
fsm_outputs.dimmrichtung != last_out.dimmrichtung ||
|
||||||
fsm_outputs.laufrichtung != last_out.laufrichtung ||
|
fsm_outputs.laufrichtung != last_out.laufrichtung ||
|
||||||
fsm_outputs.status != last_out.status
|
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;
|
||||||
|
last_in.ldr_schwelle = fsm_inputs.ldr_schwelle;
|
||||||
|
last_out.dimmrichtung = fsm_outputs.dimmrichtung;
|
||||||
|
last_out.laufrichtung = fsm_outputs.laufrichtung;
|
||||||
|
last_out.status = fsm_outputs.status;
|
||||||
|
|
||||||
Serial.printf("FSM IN: s_u: %d, s_o: %d, beendet: %d =>",
|
Serial.printf("FSM IN: s_u: %d, s_o: %d, a_b: %d, l_s: %d => ",
|
||||||
fsm_inputs.sensor_oben, fsm_inputs.sensor_unten, fsm_inputs.anim_beendet);
|
fsm_inputs.sensor_oben, fsm_inputs.sensor_unten,
|
||||||
Serial.print(" step => ");
|
fsm_inputs.anim_beendet, fsm_inputs.ldr_schwelle);
|
||||||
Serial.printf("OUT: LR: %d DR: %d ST: %d\n",
|
Serial.printf("OUT: LR: %d DR: %d ST: %d\n", fsm_outputs.laufrichtung,
|
||||||
fsm_outputs.laufrichtung, fsm_outputs.dimmrichtung, fsm_outputs.status);
|
fsm_outputs.dimmrichtung, fsm_outputs.status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Treppe::task(){
|
void Treppe::overwrite_sensors(bool s_oben, bool s_unten) {
|
||||||
//Serial.printf("LDR: %f\n", ((float)analogRead(A0))/1023.*3.68);
|
fsm_pend.web_ctrl_s_oben = s_oben;
|
||||||
|
fsm_pend.web_ctrl_s_unten = s_unten;
|
||||||
|
}
|
||||||
|
|
||||||
if(finish){
|
void Treppe::read_sensors() {
|
||||||
direction = switch_direction;
|
const bool s_oben = digitalRead(SENSOR_OBEN);
|
||||||
state = switch_state;
|
const bool s_unten = digitalRead(SENSOR_UNTEN);
|
||||||
|
|
||||||
|
fsm_pend.sensor_oben = false;
|
||||||
|
fsm_pend.sensor_unten = false;
|
||||||
|
|
||||||
|
// rising trigger => 1 cycle true !
|
||||||
|
if (s_oben && !fsm_pend.last_s_oben) {
|
||||||
|
fsm_pend.sensor_oben = true;
|
||||||
|
}
|
||||||
|
if (s_unten && !fsm_pend.last_s_unten) {
|
||||||
|
fsm_pend.sensor_unten = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fsm_inputs.ldr_schwelle = true;
|
fsm_pend.last_s_oben = s_oben;
|
||||||
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
|
fsm_pend.last_s_unten = s_unten;
|
||||||
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
|
|
||||||
fsm_inputs.anim_beendet = static_cast<bool>(finish);
|
// check for manipulation over webserver
|
||||||
|
if (fsm_pend.web_ctrl_s_oben) {
|
||||||
|
fsm_pend.sensor_oben = true;
|
||||||
|
fsm_pend.web_ctrl_s_oben = false;
|
||||||
|
}
|
||||||
|
if (fsm_pend.web_ctrl_s_unten) {
|
||||||
|
fsm_pend.sensor_unten = true;
|
||||||
|
fsm_pend.web_ctrl_s_unten = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float Treppe::read_ldr() {
|
||||||
|
/*
|
||||||
|
Reads Illuminance in Lux
|
||||||
|
|
||||||
|
FUTURE USE : show current Illuminance on Webserver in order to calibrate
|
||||||
|
|
||||||
|
Voltage Divider 1 (R13, R14):
|
||||||
|
R13 = 220k, R14 = 82k
|
||||||
|
V(ADC) = V(in1) * R14/(R13+R14)
|
||||||
|
-> V(in1) = V(ADC) * (R13+R14)/R14
|
||||||
|
V(ADC) = analogRead(A0)/1023.00
|
||||||
|
-> V(in1) = analogRead(A0)/1023.00 * (R13+R14)/R14
|
||||||
|
= analogRead(A0) * (R13+R14)/(R14*1023.00)
|
||||||
|
= analogRead(A0) * (220k+82k)/(82k*1023.00)
|
||||||
|
= analogRead(A0) * 0.0036
|
||||||
|
|
||||||
|
Voltage Divider 2 (LDR, R1 || (R13+R14))
|
||||||
|
R1 = 47k, R13+R14 = 302k -> R1||(R13+R14) = 40,67k
|
||||||
|
Vcc/V(in1) = R(LDR) / (R1||(R13+R14))
|
||||||
|
-> R(LDR) = Vcc/V(in1) * (R1||(R13+R14))
|
||||||
|
R(LDR) = 3.3V * 40.67k / V(in1)
|
||||||
|
|
||||||
|
Join formulas:
|
||||||
|
|
||||||
|
R(LDR) = 3.3V * 40.67k / (0.0036 * analogRead(A0))
|
||||||
|
= 37280.00/analogRead(A0)
|
||||||
|
ldr_ohm = R(LDR)
|
||||||
|
|
||||||
|
E(LDR) = 6526.5 * R(LDR)^-2 (see Excel Regression)
|
||||||
|
E(LDR) = 6526.5 / (R(LDR)^2)
|
||||||
|
ldr_value = E(LDR)
|
||||||
|
*/
|
||||||
|
// float ldr_ohm = 37280.00 / analogRead(A0);
|
||||||
|
float vol_adc = analogRead(A0) * 0.0036;
|
||||||
|
if(vol_adc > 3.29) // prevent negative values !
|
||||||
|
vol_adc = 3.29;
|
||||||
|
float ldr_ohm = 40.67 * (3.3 - vol_adc) / vol_adc;
|
||||||
|
float ldr_value = 6526.6 / (ldr_ohm * ldr_ohm);
|
||||||
|
#ifdef LDRDEBUG
|
||||||
|
Serial.printf("vol_adc: %f Ohm: %f lux: %f Comp: %d\n", vol_adc, ldr_ohm, ldr_value,
|
||||||
|
param.ldr_schwelle);
|
||||||
|
#endif
|
||||||
|
return ldr_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::sample_ldr() {
|
||||||
|
ldr_average += read_ldr();
|
||||||
|
ldr_average_cnt++;
|
||||||
|
if(ldr_average_cnt > LDR_AVERAGE_SAMPLES) {
|
||||||
|
float ldr_avg = static_cast<float>(ldr_average / LDR_AVERAGE_SAMPLES);
|
||||||
|
Serial.printf("ldr_avg: %f schwelle: %d\n", ldr_avg, param.ldr_schwelle);
|
||||||
|
if(check_ldr(ldr_avg)) {
|
||||||
|
update_soll_pwm_with_ldr(ldr_avg);
|
||||||
|
}
|
||||||
|
ldr_average = 0.0;
|
||||||
|
ldr_average_cnt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::update_soll_pwm_with_ldr(float ldr_avg) {
|
||||||
|
// LDR quasi linear :)
|
||||||
|
/*
|
||||||
|
soll ldr_average
|
||||||
|
---- = ------------
|
||||||
|
ist ldr_schwelle
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef LDR_REGELUNG
|
||||||
|
if(ldr_avg >= param.ldr_schwelle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
idle_pwm_soll = (1 - (ldr_avg / param.ldr_schwelle)) * param.idle_pwm_max;
|
||||||
|
Serial.printf("Update idle_pwm_soll_with_ldr: %d\n", idle_pwm_soll);
|
||||||
|
|
||||||
|
if(idle_pwm_ist != idle_pwm_soll)
|
||||||
|
fsm_inputs.ldr_changed = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Treppe::check_ldr(float ldr_avg) {
|
||||||
|
static uint8_t active = 0;
|
||||||
|
|
||||||
|
if (ldr_avg < param.ldr_schwelle) {
|
||||||
|
active = 1;
|
||||||
|
}
|
||||||
|
if (ldr_avg > param.ldr_schwelle + LDR_HYS) {
|
||||||
|
active = 0;
|
||||||
|
}
|
||||||
|
fsm_inputs.ldr_schwelle = active;
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::task() {
|
||||||
|
#ifdef DEBUG_TIMING
|
||||||
|
uint32_t m = micros();
|
||||||
|
#endif
|
||||||
|
sample_ldr();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG_TIMING
|
||||||
|
Serial.print("1:");
|
||||||
|
Serial.println(micros() - m);
|
||||||
|
m = micros();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
read_sensors();
|
||||||
|
fsm_inputs.sensor_oben = fsm_pend.sensor_oben;
|
||||||
|
fsm_inputs.sensor_unten = fsm_pend.sensor_unten;
|
||||||
|
|
||||||
|
fsm_inputs.anim_beendet = fsm_pend.anim_beendet;
|
||||||
|
|
||||||
|
#ifdef DEBUG_TIMING
|
||||||
|
Serial.print("2:");
|
||||||
|
Serial.println(micros() - m);
|
||||||
|
m = micros();
|
||||||
|
#endif
|
||||||
|
|
||||||
FSMTreppe_Obj.setExternalInputs(&fsm_inputs);
|
FSMTreppe_Obj.setExternalInputs(&fsm_inputs);
|
||||||
FSMTreppe_Obj.step();
|
FSMTreppe_Obj.step();
|
||||||
fsm_outputs = FSMTreppe_Obj.getExternalOutputs();
|
fsm_outputs = FSMTreppe_Obj.getExternalOutputs();
|
||||||
|
|
||||||
|
#ifdef DEBUG_TIMING
|
||||||
|
Serial.print("3:");
|
||||||
|
Serial.println(micros() - m);
|
||||||
|
m = micros();
|
||||||
|
#endif
|
||||||
|
|
||||||
print_state_on_change();
|
print_state_on_change();
|
||||||
|
|
||||||
direction = fsm_outputs.laufrichtung;
|
#ifdef DEBUG_TIMING
|
||||||
state = fsm_outputs.dimmrichtung;
|
Serial.print("4:");
|
||||||
|
Serial.println(micros() - m);
|
||||||
|
m = micros();
|
||||||
|
#endif
|
||||||
|
|
||||||
// setTick(ticks_treppe);
|
if (fsm_outputs.status == ST_AUFDIMMEN_HOCH ||
|
||||||
// setAnAus(1);
|
fsm_outputs.status == ST_ABDIMMEN_HOCH ||
|
||||||
// setDirection(0);
|
fsm_outputs.status == ST_AUFDIMMEN_RUNTER ||
|
||||||
// setState(0);
|
fsm_outputs.status == ST_ABDIMMEN_RUNTER) {
|
||||||
|
if (fsm_pend.anim_beendet) {
|
||||||
ledsequence();
|
start_animation(&dimmer_stufen, DIM_STUFEN, param.active_pwm,
|
||||||
}
|
idle_pwm_ist);
|
||||||
|
}
|
||||||
|
else {
|
||||||
uint16_t Treppe::setIdle(uint16_t _idle_brightness){
|
fsm_pend.anim_beendet = dimmer_tick(&dimmer_stufen, DIM_STUFEN);
|
||||||
idle_brightness = _idle_brightness;
|
}
|
||||||
Serial.println("Treppe: idle brightness changed!");
|
|
||||||
return idle_brightness;
|
|
||||||
}
|
|
||||||
uint16_t Treppe::setActive(uint16_t _active_brightness){
|
|
||||||
active_brightness = _active_brightness;
|
|
||||||
Serial.println("Treppe: active brightness changed!");
|
|
||||||
return active_brightness;
|
|
||||||
}
|
|
||||||
uint16_t Treppe::setTime(uint16_t _time_per_stair){
|
|
||||||
time_per_stair = _time_per_stair;
|
|
||||||
Serial.println("Treppe: time changed!");
|
|
||||||
return time_per_stair;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Treppe::setDirection(uint8_t _direction){
|
|
||||||
switch_direction = _direction;
|
|
||||||
Serial.printf("Treppe: switch_direction=%d!\n", switch_direction);
|
|
||||||
if(finish) Serial.println("apply direction request immediately");
|
|
||||||
else Serial.println("currently active, dir change afterwards");
|
|
||||||
// to do: implement state command variable to determine dimm-state
|
|
||||||
}
|
|
||||||
|
|
||||||
void Treppe::setState(uint8_t _state){
|
|
||||||
if(state == _state) return;
|
|
||||||
else {
|
|
||||||
switch_state = _state;
|
|
||||||
Serial.printf("Treppe: switch_state=%d!\n", switch_state);
|
|
||||||
if(finish) Serial.println("apply state request immediately");
|
|
||||||
else Serial.println("currently active, state changes after activity");
|
|
||||||
}
|
}
|
||||||
|
else if (fsm_outputs.status == ST_AUFDIMMEN_LDR ||
|
||||||
|
fsm_outputs.status == ST_ABDIMMEN_LDR) {
|
||||||
|
if (fsm_pend.anim_beendet) {
|
||||||
|
#ifdef LDR_REGELUNG
|
||||||
|
start_animation(&dimmer_ldr, DIM_LDR, idle_pwm_soll, 0);
|
||||||
|
idle_pwm_ist = idle_pwm_soll;
|
||||||
|
#else
|
||||||
|
start_animation(&dimmer_ldr, DIM_LDR, idle_pwm_ist, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fsm_pend.anim_beendet = dimmer_tick(&dimmer_ldr, DIM_LDR);
|
||||||
|
}
|
||||||
|
else if(fsm_outputs.status == ST_LDR_CHANGED) {
|
||||||
|
fsm_inputs.ldr_changed = false;
|
||||||
|
|
||||||
|
#ifdef LDR_REGELUNG
|
||||||
|
if (fsm_pend.anim_beendet) {
|
||||||
|
if(idle_pwm_soll < idle_pwm_ist) {
|
||||||
|
fsm_outputs.dimmrichtung = DR_ABDIMMEN;
|
||||||
|
start_animation(&dimmer_ldr, DIM_LDR, idle_pwm_ist, idle_pwm_soll);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fsm_outputs.dimmrichtung = DR_AUFDIMMEN;
|
||||||
|
start_animation(&dimmer_ldr, DIM_LDR, idle_pwm_soll, idle_pwm_ist);
|
||||||
|
}
|
||||||
|
idle_pwm_ist = idle_pwm_soll;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fsm_pend.anim_beendet = dimmer_tick(&dimmer_ldr, DIM_LDR);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fsm_outputs.status == ST_RUHEZUSTAND ||
|
||||||
|
fsm_outputs.status == ST_INAKTIV_LDR) {
|
||||||
|
if (param_changed) {
|
||||||
|
param_changed = false;
|
||||||
|
param = param_pend;
|
||||||
|
save_param_to_eeprom();
|
||||||
|
Serial.printf("Parameter Change applied!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_TIMING
|
||||||
|
Serial.print("5:");
|
||||||
|
Serial.println(micros() - m);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::setup() {
|
||||||
|
pwmController.resetDevices();
|
||||||
|
// Deactive PCA9685 Phase Balancer due to LED Flickering
|
||||||
|
// https://github.com/NachtRaveVL/PCA9685-Arduino/issues/15
|
||||||
|
// see also lib/PCA9685-Arduin/PCA9685.h:204
|
||||||
|
pwmController.init(PCA9685_PhaseBalancer_None);
|
||||||
|
// pwmController.init(PCA9685_PhaseBalancer_Linear);
|
||||||
|
pwmController.setPWMFrequency(200);
|
||||||
|
// pwmController.setAllChannelsPWM(idle_pwm);
|
||||||
|
|
||||||
|
// WARNING: before getting Parameters of Flash, make sure plausible parameters
|
||||||
|
// are written in flash!
|
||||||
|
EEPROM.get(EEP_START_ADDR, param); // get Parameters of flash
|
||||||
|
param_pend = param;
|
||||||
|
#ifndef LDR_REGELUNG
|
||||||
|
idle_pwm_ist = param.idle_pwm_max;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pinMode(13, OUTPUT);
|
||||||
|
pinMode(0, OUTPUT);
|
||||||
|
digitalWrite(13, HIGH);
|
||||||
|
digitalWrite(0, HIGH);
|
||||||
|
|
||||||
|
pinMode(A0, INPUT);
|
||||||
|
pinMode(SENSOR_OBEN, INPUT);
|
||||||
|
pinMode(SENSOR_UNTEN, INPUT);
|
||||||
|
pinMode(OE, OUTPUT);
|
||||||
|
digitalWrite(OE, 0);
|
||||||
|
|
||||||
|
Serial.printf("Treppe: stufen=%d\n", stufen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::save_param_to_eeprom() {
|
||||||
|
EEPROM.put(EEP_START_ADDR,
|
||||||
|
param); // copy Parameters so "EEPROM"-section in RAM
|
||||||
|
EEPROM.commit(); // write "EEPROM"-section to flash
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::set_idle_pwm_max(const uint16_t value,
|
||||||
|
const vorgabe_typ_t vorgabe_typ) {
|
||||||
|
if (vorgabe_typ == VORGABE_PROZENT) {
|
||||||
|
param_pend.idle_pwm_max = param_pend.active_pwm * value / 100;
|
||||||
|
} else if (vorgabe_typ == VORGABE_12BIT) {
|
||||||
|
param_pend.idle_pwm_max = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param_pend.idle_pwm_max > param_pend.active_pwm) {
|
||||||
|
param_pend.idle_pwm_max = param_pend.active_pwm;
|
||||||
|
}
|
||||||
|
param_changed = true;
|
||||||
|
|
||||||
|
Serial.printf("Treppe: param_pend.idle_pwm_max=%d\n",
|
||||||
|
param_pend.idle_pwm_max);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::set_active_pwm(const uint16_t value,
|
||||||
|
const vorgabe_typ_t vorgabe_typ) {
|
||||||
|
|
||||||
|
if (vorgabe_typ == VORGABE_PROZENT) {
|
||||||
|
param_pend.active_pwm = 4095 * value / 100;
|
||||||
|
} else if (vorgabe_typ == VORGABE_12BIT) {
|
||||||
|
param_pend.active_pwm = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param_pend.active_pwm > 4095) {
|
||||||
|
param_pend.idle_pwm_max = 4095;
|
||||||
|
}
|
||||||
|
param_changed = true;
|
||||||
|
|
||||||
|
Serial.printf("Treppe: param_pend.active_pwm=%d\n", param_pend.active_pwm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::set_time_ldr(const uint16_t value) {
|
||||||
|
param_pend.time_ldr = value;
|
||||||
|
if (param_pend.time_ldr > TIME_MS_MAX)
|
||||||
|
param_pend.time_ldr = TIME_MS_MAX;
|
||||||
|
param_changed = true;
|
||||||
|
|
||||||
|
Serial.printf("Treppe: time_ldr=%d\n", param_pend.time_ldr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::set_time_per_stair(const uint16_t value) {
|
||||||
|
param_pend.time_per_stair = value;
|
||||||
|
if (param_pend.time_per_stair > TIME_MS_MAX)
|
||||||
|
param_pend.time_per_stair = TIME_MS_MAX;
|
||||||
|
param_changed = true;
|
||||||
|
|
||||||
|
Serial.printf("Treppe: time_per_stair=%d\n", param_pend.time_per_stair);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::set_ldr_schwelle(const uint16_t value,
|
||||||
|
const vorgabe_typ_t vorgabe_typ) {
|
||||||
|
if (vorgabe_typ == VORGABE_PROZENT) {
|
||||||
|
// ?!
|
||||||
|
param_pend.ldr_schwelle = 10 * value / 100;
|
||||||
|
} else if (vorgabe_typ == VORGABE_12BIT) {
|
||||||
|
param_pend.ldr_schwelle = value;
|
||||||
|
}
|
||||||
|
param_changed = true;
|
||||||
|
|
||||||
|
Serial.printf("Treppe: ldr_schwelle=%d\n", param_pend.ldr_schwelle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Treppe::param_to_json(char *json_str, size_t sz) {
|
||||||
|
snprintf(json_str, sz, "{\n\
|
||||||
|
\"time_ldr\": %d,\n\
|
||||||
|
\"time_per_stair\": %d,\n\
|
||||||
|
\"idle_pwm_max\": %d,\n\
|
||||||
|
\"active_pwm\": %d,\n\
|
||||||
|
\"ldr_schwelle\": %d\n}\n",
|
||||||
|
param.time_ldr, param.time_per_stair, param.idle_pwm_max,
|
||||||
|
param.active_pwm, param.ldr_schwelle);
|
||||||
}
|
}
|
||||||
@ -1,97 +1,128 @@
|
|||||||
#pragma once
|
#ifndef __TREPPE_H
|
||||||
|
#define __TREPPE_H
|
||||||
|
|
||||||
#include "FSMTreppe/FSMTreppe2.h"
|
#include "FSMTreppe4/FSMTreppe4.h"
|
||||||
#include "PCA9685.h"
|
#include "PCA9685.h"
|
||||||
|
#include <EEPROM.h>
|
||||||
|
|
||||||
#define SENSOR_OBEN 2
|
// #define LDR_REGELUNG // comment in to activate LDR control
|
||||||
|
// #define LDRDEBUG // comment in to show LDR measurement
|
||||||
|
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux]
|
||||||
|
#define LDR_AVERAGE_SAMPLES 50
|
||||||
|
|
||||||
|
#define SENSOR_OBEN 16
|
||||||
#define SENSOR_UNTEN 12
|
#define SENSOR_UNTEN 12
|
||||||
#define OE 14
|
#define OE 14
|
||||||
|
|
||||||
#define INT_TIME 20 // interrupt intervall [ms]
|
#define INT_TIME 20 // interrupt intervall [ms]
|
||||||
|
#define TIME_MS_MAX 5000 // maximum time for animation [ms]
|
||||||
|
|
||||||
|
enum vorgabe_typ_t { VORGABE_PROZENT = 0, VORGABE_12BIT = 1 };
|
||||||
|
|
||||||
|
#define EEP_START_ADDR 100 // define Start Address for "EEPROM" storage -> depends on size of "wifi_data"!
|
||||||
|
|
||||||
class Treppe {
|
class Treppe {
|
||||||
private:
|
private:
|
||||||
|
const uint8_t stufen;
|
||||||
|
|
||||||
uint8_t stairs;
|
struct stairway_param_t {
|
||||||
uint16_t time_per_stair = 300; // dimmtime per stair [ms]
|
uint16_t time_ldr = 500;
|
||||||
uint16_t idle_brightness = 100;
|
uint16_t time_per_stair = 300; // dimmtime per stair [ms]
|
||||||
uint16_t active_brightness = 300;
|
uint16_t idle_pwm_max = 100;
|
||||||
|
uint16_t active_pwm = 2000;
|
||||||
|
uint16_t ldr_schwelle = 30; // activation value for FSM [lx]
|
||||||
|
};
|
||||||
|
stairway_param_t param;
|
||||||
|
stairway_param_t param_pend; // zwischenspeicher änderungen
|
||||||
|
bool param_changed = false;
|
||||||
|
|
||||||
uint8_t direction = 0;
|
float ldr_average = 0.0;
|
||||||
uint8_t switch_direction = 0;
|
uint16_t ldr_average_cnt = 0;
|
||||||
uint8_t state = 0;
|
uint16_t idle_pwm_ist = 0;
|
||||||
uint8_t switch_state = 0;
|
uint16_t idle_pwm_soll = 0;
|
||||||
bool finish = 1;
|
|
||||||
|
|
||||||
// alternative
|
struct fsm_pending_inputs_t {
|
||||||
uint32_t tick = 0;
|
bool anim_beendet = true;
|
||||||
uint32_t stufe = 0;
|
bool sensor_unten = false;
|
||||||
uint8_t an_aus = 0;
|
bool last_s_unten = false;
|
||||||
|
bool web_ctrl_s_unten = false;
|
||||||
|
bool sensor_oben = false;
|
||||||
|
bool last_s_oben = false;
|
||||||
|
bool web_ctrl_s_oben = false;
|
||||||
|
bool ldr_changed = false;
|
||||||
|
};
|
||||||
|
fsm_pending_inputs_t fsm_pend;
|
||||||
|
|
||||||
uint32_t ticks_treppe = 0;
|
struct dimmer_t {
|
||||||
uint32_t ticks_pro_stufe = 0;
|
uint8_t stufe = 0;
|
||||||
float differenz_pwm_pro_tick = 0.0;
|
uint16_t ticks = 0;
|
||||||
// alternative
|
uint16_t tick = 0;
|
||||||
|
|
||||||
// initialize with i2c-Address 0, use Wire Library
|
float delta_pwm = 0.0;
|
||||||
PCA9685 pwmController;
|
float pwm = 0.0;
|
||||||
FSMTreppeModelClass FSMTreppe_Obj;
|
uint16_t start_pwm = 0;
|
||||||
FSMTreppeModelClass::ExtU_FSMTreppe_T fsm_inputs;
|
uint16_t ziel_pwm = 0;
|
||||||
FSMTreppeModelClass::ExtY_FSMTreppe_T fsm_outputs;
|
};
|
||||||
void print_state_on_change();
|
enum dimmer_type_t { DIM_STUFEN = 0, DIM_LDR = 1 };
|
||||||
|
dimmer_t dimmer_stufen;
|
||||||
|
dimmer_t dimmer_ldr;
|
||||||
|
|
||||||
const uint8_t FSMTreppe_IN_animation_down = 1U;
|
// initialize with i2c-Address 0, use Wire Library
|
||||||
const uint8_t FSMTreppe_IN_animation_up = 2U;
|
PCA9685 pwmController;
|
||||||
const uint8_t FSMTreppe_IN_idle = 3U;
|
FSMTreppeModelClass FSMTreppe_Obj;
|
||||||
|
FSMTreppeModelClass::ExtU_FSMTreppe_T fsm_inputs;
|
||||||
|
FSMTreppeModelClass::ExtY_FSMTreppe_T fsm_outputs;
|
||||||
|
enum fsm_status_t {
|
||||||
|
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,
|
||||||
|
ST_LDR_CHANGED = 10
|
||||||
|
};
|
||||||
|
enum fsm_laufrichtung_t { LR_RUNTER = 0, LR_HOCH = 1 };
|
||||||
|
enum fsm_dimmrichtung_t { DR_ABDIMMEN = 0, DR_AUFDIMMEN = 1 };
|
||||||
|
|
||||||
|
void read_sensors();
|
||||||
|
void print_state_on_change();
|
||||||
|
|
||||||
|
/* DIMM */
|
||||||
|
bool dimmer_tick(dimmer_t *dimmer, bool dim_type);
|
||||||
|
void start_animation(dimmer_t *dimmer, bool dim_type, uint16_t on_pwm,
|
||||||
|
uint16_t off_pwm);
|
||||||
|
|
||||||
|
/* LDR */
|
||||||
|
bool read_sensor(int sensor);
|
||||||
|
float read_ldr();
|
||||||
|
void sample_ldr();
|
||||||
|
|
||||||
|
bool check_ldr(float ldr_avg);
|
||||||
|
void update_soll_pwm_with_ldr(float ldr_avg);
|
||||||
|
|
||||||
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval);
|
|
||||||
void ledsequence();
|
|
||||||
void rampe();
|
|
||||||
bool read_sensor(int sensor) {
|
|
||||||
int pegel = digitalRead(sensor);
|
|
||||||
return static_cast<bool>(pegel);
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
Treppe(uint8_t _stairs) : stairs(_stairs){
|
Treppe(uint8_t _stufen) : stufen(_stufen) { FSMTreppe_Obj.initialize(); }
|
||||||
FSMTreppe_Obj.initialize();
|
~Treppe() { FSMTreppe_Obj.terminate(); }
|
||||||
|
|
||||||
|
void setup();
|
||||||
|
void task(); // call periodically
|
||||||
|
|
||||||
|
// Parameter section
|
||||||
|
void save_param_to_eeprom();
|
||||||
|
void param_to_json(char* json_str, size_t sz);
|
||||||
|
|
||||||
ticks_pro_stufe = time_per_stair / 20; // [ms]
|
void set_idle_pwm_max(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
|
||||||
ticks_treppe = ticks_pro_stufe * stairs;
|
void set_active_pwm(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
|
||||||
|
|
||||||
differenz_pwm_pro_tick = (float) (active_brightness - idle_brightness)
|
void set_time_ldr(const uint16_t value);
|
||||||
/ (float) ticks_pro_stufe;
|
void set_time_per_stair(const uint16_t value);
|
||||||
}
|
void set_ldr_schwelle(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
|
||||||
~Treppe() {
|
|
||||||
FSMTreppe_Obj.terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup();
|
void overwrite_sensors(bool s_oben, bool s_unten);
|
||||||
void task(); // call periodically
|
|
||||||
|
|
||||||
// Parameter section
|
|
||||||
uint16_t setIdle(uint16_t _idle_brightness);
|
|
||||||
uint16_t setActive(uint16_t _active_brightness);
|
|
||||||
uint16_t setTime(uint16_t _time_per_stair);
|
|
||||||
|
|
||||||
void setTick(uint32_t _tick) {
|
|
||||||
tick = _tick;
|
|
||||||
Serial.printf("Treppe: Tick: %u!\n", tick);
|
|
||||||
}
|
|
||||||
uint32_t getTicks() {
|
|
||||||
return ticks_treppe;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Runtime Parameter section
|
|
||||||
void setDirection(uint8_t _direction);
|
|
||||||
void setState(uint8_t _state);
|
|
||||||
void setAnAus(uint8_t _an_aus) {
|
|
||||||
an_aus = _an_aus;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t getState() { return state;};
|
|
||||||
uint8_t getFinished() { return finish;};
|
|
||||||
uint8_t getDirection() {return direction;};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // __TREPPE_H
|
||||||
BIN
misc/LDR-Regression.xlsx
Normal file
BIN
misc/LDR-Regression.xlsx
Normal file
Binary file not shown.
17
scripts/gdboptions_win
Normal file
17
scripts/gdboptions_win
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
set remote hardware-breakpoint-limit 1
|
||||||
|
set remote hardware-watchpoint-limit 1
|
||||||
|
set remote interrupt-on-connect on
|
||||||
|
set remote kill-packet off
|
||||||
|
set remote symbol-lookup-packet off
|
||||||
|
set remote verbose-resume-packet off
|
||||||
|
mem 0x20000000 0x3fefffff ro cache
|
||||||
|
mem 0x3ff00000 0x3fffffff rw
|
||||||
|
mem 0x40000000 0x400fffff ro cache
|
||||||
|
mem 0x40100000 0x4013ffff rw cache
|
||||||
|
mem 0x40140000 0x5fffffff ro cache
|
||||||
|
mem 0x60000000 0x60001fff rw
|
||||||
|
set serial baud 460800
|
||||||
|
|
||||||
|
file .pio/build/debug/firmware.elf
|
||||||
|
target remote \\.\COM23
|
||||||
|
thb loop
|
||||||
100
src/main.cpp
100
src/main.cpp
@ -6,46 +6,59 @@
|
|||||||
|
|
||||||
#include "PCA9685.h"
|
#include "PCA9685.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "user_interface.h"
|
#include "user_interface.h"
|
||||||
}
|
}
|
||||||
// OTA & WEB
|
// OTA & WEB
|
||||||
#include "wifi_credentials.h"
|
#include <ESP8266mDNS.h>
|
||||||
#include "ota.h"
|
|
||||||
#include "httpserver.h"
|
#include "httpserver.h"
|
||||||
|
#include "ota.h"
|
||||||
|
#include "wifi_credentials.h"
|
||||||
|
#include <EEPROM.h>
|
||||||
|
|
||||||
// BOARD
|
// BOARD
|
||||||
#define ESP12_LED 2
|
#define ESP12_LED 2
|
||||||
#define NODEMCU_LED 16
|
// #define NODEMCU_LED 16
|
||||||
|
|
||||||
// PWM
|
// PWM
|
||||||
#include "treppe.h"
|
#include "treppe.h"
|
||||||
os_timer_t timer1;
|
os_timer_t timer1;
|
||||||
uint8_t timer_flag = 0;
|
uint8_t timer_flag = 0;
|
||||||
Treppe stairs(16);
|
Treppe stairs(12);
|
||||||
|
|
||||||
// WIFI
|
// WIFI
|
||||||
const char* ssid = STASSID;
|
const char *ssid = STASSID;
|
||||||
const char* password = STAPSK;
|
const char *password = STAPSK;
|
||||||
|
|
||||||
// port 80, root directory of server '/'
|
// port 80, root directory of server '/'
|
||||||
HTTPServer httpServer(80, "/");
|
HTTPServer httpServer(80, "/", &stairs);
|
||||||
|
|
||||||
uint32_t _t=0;
|
uint32_t _t = 0;
|
||||||
#define SP_US(_str,_a) Serial.print(_str); Serial.print(" took: "); Serial.print(_a); Serial.println("us")
|
#define SP_US(_str, _a) \
|
||||||
#define TIMEIF_US(_f, _l, _str) _t=micros(); _f; _t=micros()-_t; if(_t > _l) { SP_US(_str, _t); }
|
Serial.print(_str); \
|
||||||
|
Serial.print(" took: "); \
|
||||||
|
Serial.print(_a); \
|
||||||
|
Serial.println("us")
|
||||||
|
#define TIMEIF_US(_f, _l, _str) \
|
||||||
|
_t = micros(); \
|
||||||
|
_f; \
|
||||||
|
_t = micros() - _t; \
|
||||||
|
if (_t > (_l)) { \
|
||||||
|
SP_US(_str, _t); \
|
||||||
|
}
|
||||||
|
|
||||||
|
struct { // Struct for wifi-data, 40 Bytes each SSID and PW
|
||||||
|
char SSID[40] = "";
|
||||||
|
char PW[40] = "";
|
||||||
|
} wifi_data;
|
||||||
|
|
||||||
void timerCallback(void *pArg)
|
void timerCallback(void *pArg) {
|
||||||
{
|
*(static_cast<int *>(pArg)) += 1;
|
||||||
*((int *) pArg) += 1;
|
|
||||||
stairs.task();
|
stairs.task();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
uint8_t inter = 0;
|
uint8_t inter = 0;
|
||||||
ICACHE_RAM_ATTR void int_test(){
|
ICACHE_RAM_ATTR void int_test() { inter = 1; }
|
||||||
inter = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
#ifdef WITH_DEBUGGING_ON
|
#ifdef WITH_DEBUGGING_ON
|
||||||
@ -54,14 +67,24 @@ void setup() {
|
|||||||
#else
|
#else
|
||||||
Serial.begin(76800);
|
Serial.begin(76800);
|
||||||
#endif
|
#endif
|
||||||
|
Serial.println("Booting ....");
|
||||||
Serial.println(F("Booting ...."));
|
|
||||||
|
|
||||||
//pinMode(NODEMCU_LED, OUTPUT);
|
|
||||||
pinMode(ESP12_LED, OUTPUT);
|
pinMode(ESP12_LED, OUTPUT);
|
||||||
|
|
||||||
Wire.begin(); // Wire must be started first
|
EEPROM.begin(512); // init virtual "EEPROM" with size 512 Bytes
|
||||||
Wire.setClock(1000000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
|
|
||||||
|
// strncpy(wifi_data.SSID, "donotconnect", 40);
|
||||||
|
// strncpy(wifi_data.PW, "unsafe lol", 40);
|
||||||
|
|
||||||
|
EEPROM.get(0, wifi_data);
|
||||||
|
// EEPROM.commit();
|
||||||
|
|
||||||
|
Wire.begin(); // Wire must be started first
|
||||||
|
Wire.setClock(
|
||||||
|
1000000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
|
||||||
|
stairs.setup();
|
||||||
|
Serial.println("PCA9685 connected !");
|
||||||
|
// attachInterrupt(digitalPinToInterrupt(2), int_test, RISING);
|
||||||
|
// attachInterrupt(digitalPinToInterrupt(12), int_test, RISING);
|
||||||
|
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
@ -82,41 +105,24 @@ void setup() {
|
|||||||
|
|
||||||
httpServer.start();
|
httpServer.start();
|
||||||
httpServer.start_apps();
|
httpServer.start_apps();
|
||||||
|
|
||||||
Serial.println("HTTP server started !");
|
Serial.println("HTTP server started !");
|
||||||
|
|
||||||
stairs.setup();
|
if (MDNS.begin("treppenlicht")) {
|
||||||
Serial.println("PCA9685 connected !");
|
Serial.println("MDNS for treppenlicht started");
|
||||||
//attachInterrupt(digitalPinToInterrupt(2), int_test, RISING);
|
}
|
||||||
//attachInterrupt(digitalPinToInterrupt(12), int_test, RISING);
|
|
||||||
|
|
||||||
os_timer_setfn(&timer1, timerCallback, &timer_flag);
|
os_timer_setfn(&timer1, timerCallback, &timer_flag);
|
||||||
os_timer_arm(&timer1, 20, true);
|
os_timer_arm(&timer1, 20, true);
|
||||||
|
|
||||||
|
Serial.println("SSID: " + String(wifi_data.SSID) +
|
||||||
|
" PW: " + String(wifi_data.PW));
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <random>
|
|
||||||
|
|
||||||
uint32_t c = 0;
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// if(stairs.getState() == 0) {
|
if (inter != 0u) {
|
||||||
// delay(1000);
|
|
||||||
|
|
||||||
// // uint32_t t = rand() % stairs.getTicks();
|
|
||||||
// // uint32_t d = rand() % 2;
|
|
||||||
|
|
||||||
// // stairs.setTick(t);
|
|
||||||
// // stairs.setDirection(d);
|
|
||||||
|
|
||||||
// stairs.setDirection(!stairs.getDirection());
|
|
||||||
// stairs.setState(1);
|
|
||||||
// }
|
|
||||||
if(inter){
|
|
||||||
Serial.printf("interrupt\n");
|
Serial.printf("interrupt\n");
|
||||||
inter = 0;
|
inter = 0;
|
||||||
}
|
}
|
||||||
if(c++%1000000 == 0)
|
|
||||||
httpServer.logt("[%d] starting :)\n", c);
|
|
||||||
|
|
||||||
TIMEIF_US(ArduinoOTA.handle(), 10000, "OTA");
|
TIMEIF_US(ArduinoOTA.handle(), 10000, "OTA");
|
||||||
TIMEIF_US(httpServer.handleClient(), 10000, "HTTP");
|
TIMEIF_US(httpServer.handleClient(), 10000, "HTTP");
|
||||||
|
|||||||
5
start_xtensa_gdb_stub.cmd
Normal file
5
start_xtensa_gdb_stub.cmd
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
SET GDB_PATH=C:\Users\simon\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.0-newlib4.0.0-gnu23-48f7b08\bin\xtensa-lx106-elf-gdb.exe
|
||||||
|
|
||||||
|
echo "Starting gdb"
|
||||||
|
echo %GDB_PATH%
|
||||||
|
%GDB_PATH% -x ".\scripts\gdboptions_win"
|
||||||
@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
GDB_PATH=~/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.0-newlib4.0.0-gnu23-48f7b08/bin/xtensa-lx106-elf-gdb
|
GDB_PATH=~/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.0-newlib4.0.0-gnu23-48f7b08/bin/xtensa-lx106-elf-gdb
|
||||||
|
|
||||||
cd ..
|
|
||||||
echo "Starting gdb"
|
echo "Starting gdb"
|
||||||
$GDB_PATH -x scripts/gdboptions
|
$GDB_PATH -x scripts/gdboptions
|
||||||
@ -16,18 +16,23 @@ data_dir = data_gz
|
|||||||
|
|
||||||
[env:hardware]
|
[env:hardware]
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = nodemcuv2
|
; board = nodemcuv2
|
||||||
|
board = huzzah
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
; build_unflags = -Os
|
||||||
|
; build_flags = -O2
|
||||||
|
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.ldscript = eagle.flash.4m1m.ld
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
extra_scripts = pre:create_gz_files.py
|
extra_scripts = pre:create_gz_files.py
|
||||||
monitor_speed = 115200
|
|
||||||
|
|
||||||
[env:serial]
|
[env:serial]
|
||||||
extends = env:hardware
|
extends = env:hardware
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
|
upload_port = COM23
|
||||||
|
monitor_port = COM23
|
||||||
|
monitor_speed = 76800
|
||||||
|
|
||||||
[env:ota]
|
[env:ota]
|
||||||
extends = env:hardware
|
extends = env:hardware
|
||||||
@ -46,7 +51,15 @@ extends = env:hardware
|
|||||||
build_flags = -DWITH_DEBUGGING_ON -Os -g3 -ggdb3
|
build_flags = -DWITH_DEBUGGING_ON -Os -g3 -ggdb3
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
|
upload_port = COM23
|
||||||
|
|
||||||
|
; for pio check
|
||||||
|
; check_tool = cppcheck
|
||||||
|
check_tool = clangtidy
|
||||||
|
check_flags =
|
||||||
|
clangtidy: --fix-errors lib/httpserver/*
|
||||||
|
; clangtidy: lib/httpserver/* lib/treppe/* lib/treppe/FSMTreppe3/* lib/PCA9685-Arduino/*
|
||||||
|
check_skip_packages = yes
|
||||||
|
|
||||||
# This file is used compile and run tests located in the `unit` directory.
|
# This file is used compile and run tests located in the `unit` directory.
|
||||||
# For more info, see:
|
# For more info, see:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user