Thu, 25 Apr 2024 16:44:54 +0200
Version 0.9.19b1. Less noisy logging.
644
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | Migration from wiringPi to PIGPIO. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | ================================== |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | WiringPi is unmaintained and replaced by pigpio. This will need large parts |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | of thermferm to be rewritten. It is also a good moment to replace the current |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
6 | server protocol with json data and start sending data changes over |
644
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | websockets. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | Some parts of the code can make use of direct kernel support, since kernel 4 |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | there are lots of new modules. Fact is that thermferm is started in 2014, |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | that is 10 years ago. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | The current devices model is not very practical. We need to separate the parts |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | that don't need gpio out of it. All one-wire devices need their own driver |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
15 | thread. Is done. |
644
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | Current threads. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | ---------------- |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | These are the current running threads. |
663 | 22 | 1. my_one_wire_loop. |
23 | 2. my_devices_loop. | |
24 | 3. my_server_loop. | |
25 | 4. my_panel_loop. | |
26 | 5. my_simulator_loop (if enabled). | |
644
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | Steps to do. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | ------------ |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | Try to read all temperature sensors at once. The kernel supports this now. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | The devices thread needs to use the collected temperatures. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | Read all ds2413 devices from sys/bus/w1. If output bits are set different |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | then send output values. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | Add pigpio library and make it testable by the configure script. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
41 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
42 | Flow one-wire. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
43 | -------------- |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
44 | |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
45 | States: |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
46 | 1. Init state. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
47 | 2. Check for exit. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
48 | Scan for devices. Add to one-wire list. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
49 | 3. Check for exit. |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
50 | Read all DS2413 devices programmed as input. TODO: set output bits. |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
51 | 4. Check for exit. |
663 | 52 | Read one temperture sensor from list and update. |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
53 | 5. Check for exit. |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
54 | Check for missing devices not in one wire table. TODO. |
654
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
55 | Goto 2. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
56 | 6. Exit state. |
e981d0185485
Added one-wire thread and some old state table macro's. The state machine first state scans new one-wire devices and stores them in a linked list.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
57 | |
664
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
58 | |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
59 | |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
60 | Flow thermferm. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
61 | --------------- |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
62 | |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
63 | Before: |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
64 | Initialize all units. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
65 | Publish DBirth |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
66 | Publish Startup |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
67 | |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
68 | States: |
664
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
69 | |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
70 | 1. Init. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
71 | 2. Check shutdown. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
72 | Check run_pause. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
73 | Wait for new minute. |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
74 | Yes, goto 3. |
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
75 | No, goto 8. |
664
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
76 | 3. Update clock on display. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
77 | Show room temp/humidity. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
78 | 4. If THB changed or 5 minutes passed publish NData. |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
79 | 5. For units loop, do all units. |
664
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
80 | 6. Show LCD buffer. |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
81 | 7. 60 seconds reset and Minute actions. |
664
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
82 | 8. Keyboard check. |
668
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
83 | Delay 50 mSec. |
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
84 | Goto 2. |
4df4c8b17733
Upgraded MIGRATION document.
Michiel Broek <mbroek@mbse.eu>
parents:
664
diff
changeset
|
85 | 9. Done. |
664
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
86 | |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
87 | After: |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
88 | Stop all units. |
8adbc76fd122
Version 0.9.17a3. Prepare for thermferm state tables.
Michiel Broek <mbroek@mbse.eu>
parents:
663
diff
changeset
|
89 |