mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 06:27:01 +01:00
added title to cardPower
This commit is contained in:
293
HMI/README.md
293
HMI/README.md
@@ -2271,13 +2271,12 @@ Example: `entityUpd~Guest Wifi~button~navigate.prev~<~65535~~~button~navigate.ne
|
|||||||
|
|
||||||
### cardPower
|
### cardPower
|
||||||
|
|
||||||
```entityUpd~LightTest~button~navigate.prev~<~65535~~~button~navigate.next~>~65535~~~17299~C~1~100 W~17299~D~0~100 W~17299~E~3~3499.5 kWh~17299~F~-1~3499.5 kWh~17299~G~-2~3499.5 kWh~17299~H~-3~3499.5 kWh~17299~G~1~3499.5 kWh~17299~H~1~100 W```
|
```entityUpd~PowerTest~x~navUp~A~65535~~~delete~~~~~~text~sensor.power_consumption~B~17299~Power consumption~100W~1~text~sensor.power_consumption~C~17299~Power consumption~100W~1~text~sensor.today_energy~D~17299~Total energy 1~5836.0kWh~0~delete~~~~~~0~text~sensor.today_energy~E~17299~Total energy 1~5836.0kWh~-30~delete~~~~~~0~text~sensor.today_energy~F~65504~Total energy 1~5836.0kWh~90~text~sensor.today_energy~G~17299~Total energy 1~5836.0kWh~10```
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Parameter Number</th>
|
<th>Parameter Number</th>
|
||||||
<th>Category</th>
|
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Field</th>
|
<th>Field</th>
|
||||||
@@ -2287,7 +2286,6 @@ Example: `entityUpd~Guest Wifi~button~navigate.prev~<~65535~~~button~navigate.ne
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>0</td>
|
<td>0</td>
|
||||||
<td>instruction</td>
|
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>instruction</td>
|
<td>instruction</td>
|
||||||
<td>entityUpd</td>
|
<td>entityUpd</td>
|
||||||
@@ -2298,12 +2296,10 @@ Example: `entityUpd~Guest Wifi~button~navigate.prev~<~65535~~~button~navigate.ne
|
|||||||
<td>title</td>
|
<td>title</td>
|
||||||
<td>title</td>
|
<td>title</td>
|
||||||
<td>title</td>
|
<td>title</td>
|
||||||
<td>intNameEntity</td>
|
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>2</td>
|
<td>2</td>
|
||||||
<td rowspan="12">Navigation</td>
|
|
||||||
<td rowspan="6">Upper Left Icon</td>
|
<td rowspan="6">Upper Left Icon</td>
|
||||||
<td rowspan="6">Entity Definition</td>
|
<td rowspan="6">Entity Definition</td>
|
||||||
<td>type</td>
|
<td>type</td>
|
||||||
@@ -2368,181 +2364,300 @@ Example: `entityUpd~Guest Wifi~button~navigate.prev~<~65535~~~button~navigate.ne
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>14</td>
|
<td>14</td>
|
||||||
<td rowspan="32">cardPower specific</td>
|
<td rowspan="7">Home Icon / Value below Home Icon</td>
|
||||||
<td rowspan="4">Home Icon / Value below Home Icon</td>
|
<td rowspan="6">Entity Definition</td>
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
<td>type</td>
|
||||||
<td>iconColor</td>
|
<td>ignored</td>
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>15</td>
|
<td>15</td>
|
||||||
|
<td>intNameEntity</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>16</td>
|
||||||
<td>icon</td>
|
<td>icon</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>16</td>
|
|
||||||
<td>speed</td>
|
|
||||||
<td>ignored</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>17</td>
|
<td>17</td>
|
||||||
<td>text</td>
|
<td>iconColor</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>18</td>
|
<td>18</td>
|
||||||
<td rowspan="4">Value above Home Icon</td>
|
<td>displayName</td>
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
<td></td>
|
||||||
<td>iconColor</td>
|
|
||||||
<td>ignored</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>19</td>
|
<td>19</td>
|
||||||
<td>icon</td>
|
<td>optionalValue</td>
|
||||||
<td>ignored</td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>20</td>
|
<td>20</td>
|
||||||
<td>speed</td>
|
<td colspan="2">speed</td>
|
||||||
<td>ignored</td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>21</td>
|
<td>21</td>
|
||||||
<td>text</td>
|
<td rowspan="7">Value above Home Icon</td>
|
||||||
<td></td>
|
<td rowspan="6">Entity Definition</td>
|
||||||
|
<td>type</td>
|
||||||
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>22</td>
|
<td>22</td>
|
||||||
<td rowspan="4">1st Item Upper Left</td>
|
<td>intNameEntity</td>
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
<td>ignored</td>
|
||||||
<td>iconColor</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>23</td>
|
<td>23</td>
|
||||||
<td>icon</td>
|
<td>icon</td>
|
||||||
<td></td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>24</td>
|
<td>24</td>
|
||||||
<td>speed</td>
|
<td>iconColor</td>
|
||||||
<td>numbers (-2,-1,0,1,2)</td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>25</td>
|
<td>25</td>
|
||||||
<td>text</td>
|
<td>displayName</td>
|
||||||
<td></td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>26</td>
|
<td>26</td>
|
||||||
<td rowspan="4">2nd Item Middle Left</td>
|
<td>optionalValue</td>
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
|
||||||
<td>iconColor</td>
|
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>27</td>
|
<td>27</td>
|
||||||
<td>icon</td>
|
<td colspan="2">speed</td>
|
||||||
<td></td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>28</td>
|
<td>28</td>
|
||||||
<td>speed</td>
|
<td rowspan="7">1st Item Upper Left</td>
|
||||||
<td>numbers (-2,-1,0,1,2)</td>
|
<td rowspan="6">Entity Definition</td>
|
||||||
|
<td>type</td>
|
||||||
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>29</td>
|
<td>29</td>
|
||||||
<td>text</td>
|
<td>intNameEntity</td>
|
||||||
<td></td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>30</td>
|
<td>30</td>
|
||||||
<td rowspan="4">3rd Item Bottom Left</td>
|
<td>icon</td>
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
|
||||||
<td>iconColor</td>
|
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>31</td>
|
<td>31</td>
|
||||||
<td>icon</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>32</td>
|
|
||||||
<td>speed</td>
|
|
||||||
<td>numbers (-2,-1,0,1,2)</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>33</td>
|
|
||||||
<td>text</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>34</td>
|
|
||||||
<td rowspan="4">4th Item Upper Right</td>
|
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
|
||||||
<td>iconColor</td>
|
<td>iconColor</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>32</td>
|
||||||
|
<td>displayName</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>33</td>
|
||||||
|
<td>optionalValue</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>34</td>
|
||||||
|
<td colspan="2">speed</td>
|
||||||
|
<td>numbers (between -120 and 120)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>35</td>
|
<td>35</td>
|
||||||
|
<td rowspan="7">2nd Item Middle Left</td>
|
||||||
|
<td rowspan="6">Entity Definition</td>
|
||||||
|
<td>type</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>36</td>
|
||||||
|
<td>intNameEntity</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>37</td>
|
||||||
<td>icon</td>
|
<td>icon</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>36</td>
|
|
||||||
<td>speed</td>
|
|
||||||
<td>numbers (-2,-1,0,1,2)</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>37</td>
|
|
||||||
<td>text</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>38</td>
|
<td>38</td>
|
||||||
<td rowspan="4">5thItem Middle Right</td>
|
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
|
||||||
<td>iconColor</td>
|
<td>iconColor</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>39</td>
|
<td>39</td>
|
||||||
<td>icon</td>
|
<td>displayName</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>40</td>
|
<td>40</td>
|
||||||
<td>speed</td>
|
<td>optionalValue</td>
|
||||||
<td>numbers (-2,-1,0,1,2)</td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>41</td>
|
<td>41</td>
|
||||||
<td>text</td>
|
<td colspan="2">speed</td>
|
||||||
<td></td>
|
<td>numbers (between -120 and 120)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>42</td>
|
<td>42</td>
|
||||||
<td rowspan="4">6th Item Bottom Right</td>
|
<td rowspan="7">3rd Item Bottom Left</td>
|
||||||
<td rowspan="4">Power Entity Definition</td>
|
<td rowspan="6">Entity Definition</td>
|
||||||
<td>iconColor</td>
|
<td>type</td>
|
||||||
<td></td>
|
<td>ignored</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>43</td>
|
<td>43</td>
|
||||||
|
<td>intNameEntity</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>44</td>
|
||||||
<td>icon</td>
|
<td>icon</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>44</td>
|
<td>45</td>
|
||||||
<td>speed</td>
|
<td>iconColor</td>
|
||||||
<td>numbers (-2,-1,0,1,2)</td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>45</td>
|
<td>46</td>
|
||||||
<td>text</td>
|
<td>displayName</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>47</td>
|
||||||
|
<td>optionalValue</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>48</td>
|
||||||
|
<td colspan="2">speed</td>
|
||||||
|
<td>numbers (between -120 and 120)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>49</td>
|
||||||
|
<td rowspan="7">4th Item Upper Right</td>
|
||||||
|
<td rowspan="6">Entity Definition</td>
|
||||||
|
<td>type</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>50</td>
|
||||||
|
<td>intNameEntity</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>51</td>
|
||||||
|
<td>icon</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>52</td>
|
||||||
|
<td>iconColor</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>53</td>
|
||||||
|
<td>displayName</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>54</td>
|
||||||
|
<td>optionalValue</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>55</td>
|
||||||
|
<td colspan="2">speed</td>
|
||||||
|
<td>numbers (between -120 and 120)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>56</td>
|
||||||
|
<td rowspan="7">5th Item Middle Right</td>
|
||||||
|
<td rowspan="6">Entity Definition</td>
|
||||||
|
<td>type</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>57</td>
|
||||||
|
<td>intNameEntity</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>58</td>
|
||||||
|
<td>icon</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>59</td>
|
||||||
|
<td>iconColor</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>60</td>
|
||||||
|
<td>displayName</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>61</td>
|
||||||
|
<td>optionalValue</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>62</td>
|
||||||
|
<td colspan="2">speed</td>
|
||||||
|
<td>numbers (between -120 and 120)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>63</td>
|
||||||
|
<td rowspan="7">6th Item Bottom Right</td>
|
||||||
|
<td rowspan="6">Entity Definition</td>
|
||||||
|
<td>type</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>64</td>
|
||||||
|
<td>intNameEntity</td>
|
||||||
|
<td>ignored</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>65</td>
|
||||||
|
<td>icon</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>66</td>
|
||||||
|
<td>iconColor</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>67</td>
|
||||||
|
<td>displayName</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>68</td>
|
||||||
|
<td>optionalValue</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>69</td>
|
||||||
|
<td colspan="2">speed</td>
|
||||||
|
<td>numbers (between -120 and 120)</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -2,39 +2,36 @@ from shared import *
|
|||||||
head = sharedhead + """
|
head = sharedhead + """
|
||||||
if(tInstruction.txt=="entityUpd")
|
if(tInstruction.txt=="entityUpd")
|
||||||
{
|
{
|
||||||
// command format: entityUpd,heading,navigation,colorHome,iconHome[,iconColor,icon,speed,valueUp,valueDown]x6
|
|
||||||
spstr strCommand.txt,tHeading.txt,"~",1
|
spstr strCommand.txt,tHeading.txt,"~",1
|
||||||
""" + navigation + """
|
""" + navigation + """
|
||||||
// icon color home
|
// icon color home
|
||||||
spstr strCommand.txt,tTmp.txt,"~",14
|
spstr strCommand.txt,tTmp.txt,"~",17
|
||||||
covx tTmp.txt,t1.pco,0,0
|
covx tTmp.txt,t1.pco,0,0
|
||||||
// icon home
|
// icon home
|
||||||
spstr strCommand.txt,t1.txt,"~",15
|
spstr strCommand.txt,t1.txt,"~",16
|
||||||
// speed 16 ignored
|
// speed 16 ignored
|
||||||
// text home
|
// text home
|
||||||
spstr strCommand.txt,tHome.txt,"~",17
|
spstr strCommand.txt,tHome.txt,"~",19
|
||||||
spstr tHome.txt,tHome2.txt," ",1
|
spstr tHome.txt,tHome2.txt," ",1
|
||||||
spstr tHome.txt,tHome.txt," ",0
|
spstr tHome.txt,tHome.txt," ",0
|
||||||
// icon color 18 ignored
|
|
||||||
// icon 19 ignored
|
|
||||||
// speed 20 ignored
|
|
||||||
// text home
|
// text home
|
||||||
spstr strCommand.txt,tHomeO.txt,"~",21
|
spstr strCommand.txt,tHomeO.txt,"~",26
|
||||||
spstr tHomeO.txt,tHomeO2.txt," ",1
|
spstr tHomeO.txt,tHomeO2.txt," ",1
|
||||||
spstr tHomeO.txt,tHomeO.txt," ",0
|
spstr tHomeO.txt,tHomeO.txt," ",0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print(head)
|
print(head)
|
||||||
start = 22
|
start = 27
|
||||||
for i in range(0,6):
|
for i in range(0,6):
|
||||||
idxstart = start + (i)*4
|
idxstart = start + (i)*7
|
||||||
item = f"""
|
item = f"""
|
||||||
// iconColor
|
// iconColor
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart}
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart+4}
|
||||||
covx tTmp.txt,t{i}Icon.pco,0,0
|
covx tTmp.txt,t{i}Icon.pco,0,0
|
||||||
// icon
|
// icon
|
||||||
spstr strCommand.txt,t{i}Icon.txt,"~",{idxstart+1}
|
spstr strCommand.txt,t{i}Icon.txt,"~",{idxstart+3}
|
||||||
// speed
|
// speed
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart+2}
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart+7}
|
||||||
covx tTmp.txt,t{i}Speed.val,0,0
|
covx tTmp.txt,t{i}Speed.val,0,0
|
||||||
if(t{i}Speed.val>120)
|
if(t{i}Speed.val>120)
|
||||||
{{
|
{{
|
||||||
@@ -45,8 +42,9 @@ for i in range(0,6):
|
|||||||
t{i}Speed.val=-120
|
t{i}Speed.val=-120
|
||||||
}}
|
}}
|
||||||
// lower text
|
// lower text
|
||||||
spstr strCommand.txt,t{i}u.txt,"~",{idxstart+3}
|
spstr strCommand.txt,t{i}u.txt,"~",{idxstart+6}
|
||||||
|
// upper text
|
||||||
|
spstr strCommand.txt,t{i}o.txt,"~",{idxstart+5}
|
||||||
if(t{i}Icon.txt!="")
|
if(t{i}Icon.txt!="")
|
||||||
{{
|
{{
|
||||||
vis t{i}Icon,1
|
vis t{i}Icon,1
|
||||||
|
|||||||
@@ -1,402 +0,0 @@
|
|||||||
|
|
||||||
// data available
|
|
||||||
if(usize>1)
|
|
||||||
{
|
|
||||||
bufferPos=0
|
|
||||||
while(bufferPos<usize)
|
|
||||||
{
|
|
||||||
// check for 0x55 0xBB - Command Init Secuence
|
|
||||||
if(u[bufferPos]==187&&u[bufferPos-1]==85)
|
|
||||||
{
|
|
||||||
//remove garbage at the start of the buffer if there's any to free buffer for command
|
|
||||||
if(u[bufferPos]!=1)
|
|
||||||
{
|
|
||||||
udelete bufferPos-1
|
|
||||||
}
|
|
||||||
//instruction is now aligned with buffer, because we deleted garbage before instrcution
|
|
||||||
//get length after init sequence (check if there are more than to bytes in buffer)
|
|
||||||
if(3<usize)
|
|
||||||
{
|
|
||||||
// check if serial buffer has reached the announced length
|
|
||||||
ucopy payloadLength,2,2,0
|
|
||||||
// we are only checking payload length so we have to skip first 3 bytes (init+payload length) (-1 because of < instead of <=)
|
|
||||||
payloadLength+=3
|
|
||||||
// payload length does also not contain crc, so we are adding another 2 bytes for crc
|
|
||||||
payloadLength+=2
|
|
||||||
if(payloadLength<usize)
|
|
||||||
{
|
|
||||||
// calculate crc
|
|
||||||
crcrest 1,0xFFFF
|
|
||||||
// u[2] contains payload legth at 3rd pos in buffer, we are calculating crc from 3rd pos with number of bytes from payload length
|
|
||||||
//crcputu 3,u[2]
|
|
||||||
// u[2] cotnains payload length, we are calculating a crc over the whole message, so we have to add 3 to the length from u[2]
|
|
||||||
crcputu 0,payloadLength-1
|
|
||||||
// get recived crc to be able to compare it
|
|
||||||
ucopy recvCrc,payloadLength-1,2,0
|
|
||||||
// compare crc with recived value
|
|
||||||
if(crcval==recvCrc)
|
|
||||||
{
|
|
||||||
// crc is okay
|
|
||||||
// here is the location where acual code should be
|
|
||||||
// write command to variable strCommand
|
|
||||||
ucopy strCommand.txt,4,payloadLength-5,0
|
|
||||||
// write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
|
||||||
spstr strCommand.txt,tInstruction.txt,"~",0
|
|
||||||
|
|
||||||
if(tInstruction.txt=="wake")
|
|
||||||
{
|
|
||||||
click tc0,1
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="dimmode")
|
|
||||||
{
|
|
||||||
// get value
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",1
|
|
||||||
covx tTmp.txt,dimValue,0,0
|
|
||||||
dim=dimValue
|
|
||||||
// get value normal
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
|
||||||
covx tTmp.txt,dimValueNormal,0,0
|
|
||||||
// get background color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
|
||||||
if(tTmp.txt!="")
|
|
||||||
{
|
|
||||||
covx tTmp.txt,defaultBcoColor,0,0
|
|
||||||
}
|
|
||||||
// get font color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
|
||||||
if(tTmp.txt!="")
|
|
||||||
{
|
|
||||||
covx tTmp.txt,defaultFontColor,0,0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="time")
|
|
||||||
{
|
|
||||||
click m0,1
|
|
||||||
//get set time to global variable
|
|
||||||
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
|
|
||||||
spstr pageIcons.vaTime.txt,tTime.txt,"?",0
|
|
||||||
spstr pageIcons.vaTime.txt,tAMPM.txt,"?",1
|
|
||||||
if(tAMPM.txt=="")
|
|
||||||
{
|
|
||||||
vis tAMPM,0
|
|
||||||
}
|
|
||||||
spstr strCommand.txt,tTimeAdd.txt,"~",2
|
|
||||||
ref tIcon1
|
|
||||||
ref tIcon2
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="date")
|
|
||||||
{
|
|
||||||
//get set date to global variable
|
|
||||||
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
|
|
||||||
tDate.txt=pageIcons.vaDate.txt
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="statusUpdate")
|
|
||||||
{
|
|
||||||
//statusIcon1
|
|
||||||
spstr strCommand.txt,tIcon1.txt,"~",1
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
|
||||||
covx tTmp.txt,tIcon1.pco,0,0
|
|
||||||
//statusIcon2
|
|
||||||
spstr strCommand.txt,tIcon2.txt,"~",3
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
|
||||||
covx tTmp.txt,tIcon2.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",5
|
|
||||||
if(tTmp.txt!="")
|
|
||||||
{
|
|
||||||
tIcon1.font=3
|
|
||||||
}
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",6
|
|
||||||
if(tTmp.txt!="")
|
|
||||||
{
|
|
||||||
tIcon2.font=3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="weatherUpdate"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
|
|
||||||
{
|
|
||||||
vis tMainIcon,1
|
|
||||||
vis tMainIconAlt,0
|
|
||||||
vis tMainText,1
|
|
||||||
vis tMainTextAlt,0
|
|
||||||
vis tMainTextAlt2,0
|
|
||||||
vis tMainIconAlt2,0
|
|
||||||
|
|
||||||
|
|
||||||
//tMainIcon
|
|
||||||
spstr strCommand.txt,tMainIcon.txt,"~",3
|
|
||||||
tMainIconAlt.txt=tMainIcon.txt
|
|
||||||
//tMainIcon Color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
|
||||||
covx tTmp.txt,tMainIcon.pco,0,0
|
|
||||||
tMainIconAlt.pco=tMainIcon.pco
|
|
||||||
//tMainText
|
|
||||||
spstr strCommand.txt,tMainText.txt,"~",6
|
|
||||||
tMainTextAlt.txt=tMainText.txt
|
|
||||||
|
|
||||||
//tForecast1
|
|
||||||
spstr strCommand.txt,tForecast1.txt,"~",11
|
|
||||||
//tF1Icon
|
|
||||||
spstr strCommand.txt,tF1Icon.txt,"~",9
|
|
||||||
//tF1Icon Color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",10
|
|
||||||
covx tTmp.txt,tF1Icon.pco,0,0
|
|
||||||
//tForecast1Val
|
|
||||||
spstr strCommand.txt,tForecast1Val.txt,"~",12
|
|
||||||
|
|
||||||
|
|
||||||
//tForecast2
|
|
||||||
spstr strCommand.txt,tForecast2.txt,"~",17
|
|
||||||
//tF2Icon
|
|
||||||
spstr strCommand.txt,tF2Icon.txt,"~",15
|
|
||||||
//tF2Icon Color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",16
|
|
||||||
covx tTmp.txt,tF2Icon.pco,0,0
|
|
||||||
//tForecast2Val
|
|
||||||
spstr strCommand.txt,tForecast2Val.txt,"~",18
|
|
||||||
|
|
||||||
|
|
||||||
//tForecast3
|
|
||||||
spstr strCommand.txt,tForecast3.txt,"~",23
|
|
||||||
//tF3Icon
|
|
||||||
spstr strCommand.txt,tF3Icon.txt,"~",21
|
|
||||||
//tF3Icon Color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",22
|
|
||||||
covx tTmp.txt,tF3Icon.pco,0,0
|
|
||||||
//tForecast3Val
|
|
||||||
spstr strCommand.txt,tForecast3Val.txt,"~",24
|
|
||||||
|
|
||||||
|
|
||||||
//tForecast4
|
|
||||||
spstr strCommand.txt,tForecast4.txt,"~",29
|
|
||||||
//tF4Icon
|
|
||||||
spstr strCommand.txt,tF4Icon.txt,"~",27
|
|
||||||
//tF4Icon Color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",28
|
|
||||||
covx tTmp.txt,tF4Icon.pco,0,0
|
|
||||||
//tForecast4Val
|
|
||||||
spstr strCommand.txt,tForecast4Val.txt,"~",30
|
|
||||||
|
|
||||||
|
|
||||||
//alternative layout
|
|
||||||
//tMainTextAlt2
|
|
||||||
spstr strCommand.txt,tMainTextAlt2.txt,"~",36
|
|
||||||
//tMainIconAlt2
|
|
||||||
spstr strCommand.txt,tMainIconAlt2.txt,"~",33
|
|
||||||
|
|
||||||
//tMainIconAlt2 Color
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",34
|
|
||||||
covx tTmp.txt,tMainIconAlt2.pco,0,0
|
|
||||||
|
|
||||||
if(tMainTextAlt2.txt!=""&&p0.w!=320)
|
|
||||||
{
|
|
||||||
//value for tMRIcon, activate alternative layout
|
|
||||||
vis tMainIcon,0
|
|
||||||
vis tMainText,0
|
|
||||||
vis tMainTextAlt,1
|
|
||||||
vis tMainIconAlt,1
|
|
||||||
vis tMainTextAlt2,1
|
|
||||||
vis tMainIconAlt2,1
|
|
||||||
vis tForecast1,0
|
|
||||||
vis tF1Icon,0
|
|
||||||
vis tForecast1Val,0
|
|
||||||
//move forecast values to the right
|
|
||||||
tForecast4.txt=tForecast3.txt
|
|
||||||
tForecast3.txt=tForecast2.txt
|
|
||||||
tForecast2.txt=tForecast1.txt
|
|
||||||
tForecast4Val.txt=tForecast3Val.txt
|
|
||||||
tForecast3Val.txt=tForecast2Val.txt
|
|
||||||
tForecast2Val.txt=tForecast1Val.txt
|
|
||||||
tF4Icon.txt=tF3Icon.txt
|
|
||||||
tF3Icon.txt=tF2Icon.txt
|
|
||||||
tF2Icon.txt=tF1Icon.txt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
|
|
||||||
{
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",1
|
|
||||||
covx tTmp.txt,tTime.bco,0,0
|
|
||||||
if(tTime.bco!=screensaver.bco)
|
|
||||||
{
|
|
||||||
screensaver.bco=tTime.bco
|
|
||||||
tAMPM.bco=tTime.bco
|
|
||||||
tDate.bco=tTime.bco
|
|
||||||
tMainIcon.bco=tTime.bco
|
|
||||||
tMainText.bco=tTime.bco
|
|
||||||
tMainIconAlt.bco=tTime.bco
|
|
||||||
tMainTextAlt.bco=tTime.bco
|
|
||||||
tMainTextAlt2.bco=tTime.bco
|
|
||||||
tMainIconAlt2.bco=tTime.bco
|
|
||||||
tIcon1.bco=tTime.bco
|
|
||||||
tIcon2.bco=tTime.bco
|
|
||||||
tForecast1.bco=tTime.bco
|
|
||||||
tForecast1Val.bco=tTime.bco
|
|
||||||
tF1Icon.bco=tTime.bco
|
|
||||||
tForecast2.bco=tTime.bco
|
|
||||||
tForecast2Val.bco=tTime.bco
|
|
||||||
tF2Icon.bco=tTime.bco
|
|
||||||
tForecast3.bco=tTime.bco
|
|
||||||
tForecast3Val.bco=tTime.bco
|
|
||||||
tF3Icon.bco=tTime.bco
|
|
||||||
tForecast4.bco=tTime.bco
|
|
||||||
tForecast4Val.bco=tTime.bco
|
|
||||||
tF4Icon.bco=tTime.bco
|
|
||||||
tTimeAdd.bco=tTime.bco
|
|
||||||
}
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
|
||||||
covx tTmp.txt,tTime.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
|
||||||
covx tTmp.txt,tAMPM.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
|
||||||
covx tTmp.txt,tDate.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",5
|
|
||||||
covx tTmp.txt,tMainText.pco,0,0
|
|
||||||
tMainTextAlt.pco=tMainText.pco
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",6
|
|
||||||
covx tTmp.txt,tForecast1.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",7
|
|
||||||
covx tTmp.txt,tForecast2.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",8
|
|
||||||
covx tTmp.txt,tForecast3.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",9
|
|
||||||
covx tTmp.txt,tForecast4.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",10
|
|
||||||
covx tTmp.txt,tForecast1Val.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",11
|
|
||||||
covx tTmp.txt,tForecast2Val.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",12
|
|
||||||
covx tTmp.txt,tForecast3Val.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",13
|
|
||||||
covx tTmp.txt,tForecast4Val.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",14
|
|
||||||
covx tTmp.txt,t10.bco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",15
|
|
||||||
covx tTmp.txt,tMainTextAlt2.pco,0,0
|
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",16
|
|
||||||
//covx tTmp.txt,tMR.pco,0,0
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",17
|
|
||||||
covx tTmp.txt,tTimeAdd.pco,0,0
|
|
||||||
if(tMainTextAlt2.txt!=""&&p0.w!=320)
|
|
||||||
{
|
|
||||||
tForecast4Val.pco=tForecast3Val.pco
|
|
||||||
tForecast3Val.pco=tForecast2Val.pco
|
|
||||||
tForecast2Val.pco=tForecast1Val.pco
|
|
||||||
tForecast4.pco=tForecast3.pco
|
|
||||||
tForecast3.pco=tForecast2.pco
|
|
||||||
tForecast2.pco=tForecast1.pco
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="notify")
|
|
||||||
{
|
|
||||||
spstr strCommand.txt,tNotifyHead.txt,"~",1
|
|
||||||
spstr strCommand.txt,tNotifyText.txt,"~",2
|
|
||||||
if(tNotifyHead.txt!=""||tNotifyText.txt!="")
|
|
||||||
{
|
|
||||||
vis tNotifyHead,1
|
|
||||||
vis tNotifyText,1
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
vis tNotifyHead,0
|
|
||||||
vis tNotifyText,0
|
|
||||||
}
|
|
||||||
tNotifyHead.bco=tTime.bco
|
|
||||||
tNotifyText.bco=tTime.bco
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
|
||||||
if(tTmp.txt!="")
|
|
||||||
{
|
|
||||||
covx tTmp.txt,tNotifyHead.pco,0,0
|
|
||||||
}
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
|
||||||
if(tTmp.txt!="")
|
|
||||||
{
|
|
||||||
covx tTmp.txt,tNotifyText.pco,0,0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tInstruction.txt=="pageType")
|
|
||||||
{
|
|
||||||
dim=100
|
|
||||||
//command format pageType,specialPageName
|
|
||||||
//write name of speical page to tId
|
|
||||||
spstr strCommand.txt,tId.txt,"~",1
|
|
||||||
//save second arg if there's one
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
|
||||||
//save third arg if there's one
|
|
||||||
spstr strCommand.txt,pageIcons.tTmp2.txt,"~",3
|
|
||||||
spstr strCommand.txt,pageIcons.tTmp3.txt,"~",4
|
|
||||||
//we are going to exit this page with this command, so we have to clear the buffer, so we are not getting into a stupid loop ...
|
|
||||||
udelete payloadLength-1
|
|
||||||
bufferPos=0
|
|
||||||
if(tId.txt=="pageStartup")
|
|
||||||
{
|
|
||||||
page pageStartup
|
|
||||||
}
|
|
||||||
if(tId.txt=="screensaver")
|
|
||||||
{
|
|
||||||
page screensaver
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardEntities")
|
|
||||||
{
|
|
||||||
page cardEntities
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardGrid")
|
|
||||||
{
|
|
||||||
page cardGrid
|
|
||||||
}
|
|
||||||
if(tId.txt=="popupLight")
|
|
||||||
{
|
|
||||||
pageIcons.tTmp1.txt=tTmp.txt
|
|
||||||
page popupLight
|
|
||||||
}
|
|
||||||
if(tId.txt=="popupShutter")
|
|
||||||
{
|
|
||||||
pageIcons.tTmp1.txt=tTmp.txt
|
|
||||||
page popupShutter
|
|
||||||
}
|
|
||||||
if(tId.txt=="popupNotify")
|
|
||||||
{
|
|
||||||
page popupNotify
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardThermo")
|
|
||||||
{
|
|
||||||
page cardThermo
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardMedia")
|
|
||||||
{
|
|
||||||
page cardMedia
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardAlarm")
|
|
||||||
{
|
|
||||||
page cardAlarm
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardQR")
|
|
||||||
{
|
|
||||||
page cardQR
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardPower")
|
|
||||||
{
|
|
||||||
page cardPower
|
|
||||||
}
|
|
||||||
if(tId.txt=="cardChart")
|
|
||||||
{
|
|
||||||
page cardChart
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tInstruction.txt=="timeout")
|
|
||||||
{
|
|
||||||
//set timeout to global var
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",1
|
|
||||||
covx tTmp.txt,sleepTimeout,0,0
|
|
||||||
}
|
|
||||||
// end of user code
|
|
||||||
udelete payloadLength-1
|
|
||||||
bufferPos=0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// next character
|
|
||||||
bufferPos++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
Reference in New Issue
Block a user