Sat, 06 Apr 2024 17:21:29 +0200
Updated MIGRATION document.
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 |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | server protocol with json data and start sending data chaanges over |
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 |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | thread. |
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. |
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
|
50 | Read all DS2413 devices programmed as input. |
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. |
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
|
54 | Check for missing devices not in one wire table. |
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 |