MIGRATION

changeset 668
4df4c8b17733
parent 664
8adbc76fd122
child 725
b15a2ae7bea7
equal deleted inserted replaced
667:bba6ca418e09 668:4df4c8b17733
1 Migration from wiringPi to PIGPIO. 1 Migration from wiringPi to PIGPIO.
2 ================================== 2 ==================================
3 3
4 WiringPi is unmaintained and replaced by pigpio. This will need large parts 4 WiringPi is unmaintained and replaced by pigpio. This will need large parts
5 of thermferm to be rewritten. It is also a good moment to replace the current 5 of thermferm to be rewritten. It is also a good moment to replace the current
6 server protocol with json data and start sending data chaanges over 6 server protocol with json data and start sending data changes over
7 websockets. 7 websockets.
8 8
9 Some parts of the code can make use of direct kernel support, since kernel 4 9 Some parts of the code can make use of direct kernel support, since kernel 4
10 there are lots of new modules. Fact is that thermferm is started in 2014, 10 there are lots of new modules. Fact is that thermferm is started in 2014,
11 that is 10 years ago. 11 that is 10 years ago.
12 12
13 The current devices model is not very practical. We need to separate the parts 13 The current devices model is not very practical. We need to separate the parts
14 that don't need gpio out of it. All one-wire devices need their own driver 14 that don't need gpio out of it. All one-wire devices need their own driver
15 thread. 15 thread. Is done.
16 16
17 17
18 Current threads. 18 Current threads.
19 ---------------- 19 ----------------
20 20
45 States: 45 States:
46 1. Init state. 46 1. Init state.
47 2. Check for exit. 47 2. Check for exit.
48 Scan for devices. Add to one-wire list. 48 Scan for devices. Add to one-wire list.
49 3. Check for exit. 49 3. Check for exit.
50 Read all DS2413 devices programmed as input. 50 Read all DS2413 devices programmed as input. TODO: set output bits.
51 4. Check for exit. 51 4. Check for exit.
52 Read one temperture sensor from list and update. 52 Read one temperture sensor from list and update.
53 5. Check for exit. 53 5. Check for exit.
54 Check for missing devices not in one wire table. 54 Check for missing devices not in one wire table. TODO.
55 Goto 2. 55 Goto 2.
56 6. Exit state. 56 6. Exit state.
57 57
58 58
59 59
63 Before: 63 Before:
64 Initialize all units. 64 Initialize all units.
65 Publish DBirth 65 Publish DBirth
66 Publish Startup 66 Publish Startup
67 67
68 States (nested): 68 States:
69 69
70 1. Init. 70 1. Init.
71 2. Check shutdown. 71 2. Check shutdown.
72 Check run_pause. 72 Check run_pause.
73 Wait for new minute. 73 Wait for new minute.
74 Yes, goto 3.
75 No, goto 8.
74 3. Update clock on display. 76 3. Update clock on display.
75 Show room temp/humidity. 77 Show room temp/humidity.
76 4. If THB changed or 5 minutes passed publish NData. 78 4. If THB changed or 5 minutes passed publish NData.
77 5. For units loop. 79 5. For units loop, do all units.
78
79 1. Init.
80 2. If air address
81 3. If beer address
82 4. If chiller address
83 5. If door address
84 6. If PSU address
85 7. If unit->mode == UNITMODE_PROFILE
86 8. If unit->mode == UNITMODE_NONE
87 9. Usage counters
88 10. If light address
89 11. if ((unit->mode == UNITMODE_FRIDGE) || (unit->mode == UNITMODE_BEER) || (unit->mode == UNITMODE_PROFILE)) // Temp control active
90 12. Update the LCD
91 13. Set unit->mqtt_flag |= MQTT_FLAG_DATA after 60 seconds
92 14. Publish what is needed.
93 15. Handle alarms.
94 16. End.
95
96 6. Show LCD buffer. 80 6. Show LCD buffer.
97 7. 60 seconds reset and actions. 81 7. 60 seconds reset and Minute actions.
98 8. Keyboard check. 82 8. Keyboard check.
99 9. Delay 100 mSec and goto 2. 83 Delay 50 mSec.
100 10. Done. 84 Goto 2.
85 9. Done.
101 86
102 After: 87 After:
103 Stop all units. 88 Stop all units.
104 89

mercurial