Fri, 05 Apr 2024 19:30:41 +0200
Version 0.9.17a2. Disabled a lot of mutex locks, some are blocking and need to be fixed. This version seems to be working, more or less.
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. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | 1. my_devices_loop. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | 2. my_server_loop. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | 3. my_panel_loop. |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | 4. my_simulator_loop (if enabled). |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
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 | 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
|
30 | ------------ |
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 | Write a new thread for the one-wire devices. Make it a dynamic table. The |
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 | old device table is still needed to tie devices to fermenters. |
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 | 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
|
35 | 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
|
36 | 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
|
37 | 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
|
38 | Create tables for ds28b20 and ds2413. Simulated and real sensors should |
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 | share these tables. |
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 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
07cc86900473
Added MIGRATION document. Trying to drop usleep() call to replace by nanosleep(). Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | 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
|
43 | |
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
|
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 | 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
|
46 | -------------- |
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 | |
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 | 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
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | 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
|
53 | 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
|
54 | 4. 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
|
55 | Read one temperture sensor from list and update device. |
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 | 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
|
57 | 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
|
58 | 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
|
59 | 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
|
60 |