Multitasking ?

Code tips and tricks for beginners
BeanieBots
Posts: 361
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 197 times
Been thanked: 115 times

Re: Multitasking ?

Post by BeanieBots »

Much appreciated. Thanks.
Stuart
Posts: 138
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 5 times
Been thanked: 20 times

Re: Multitasking ?

Post by Stuart »

I have finally started using this new version of tempr$, which is excellent and allows much better updating. The routine is called once every three seconds, which is ample time for the conversions, and it is all non-blocking. I use the sensor id string to distinguish between them, e.g this is in the setup:

Code: [Local Link Removed for Guests]

ext_sensor_id$     = "28db49ec00000063"
hw_sensor_id$      = "28883c18291901ce"
ch_sensor_id$      = "288978c400000006"
ret_sensor_id$     = "289764c400000013"
temp_pin           = 13 'all sensors on this pin
ret$ = tempr$(temp_pin,0) 'request all readings
the disp_temp lines are a sub that writes to a tft display. To get the sensor id strings use tempr$(temp_pin), list the result and copy it into your code.

Code: [Local Link Removed for Guests]

'===========
read_temps:
'===========
 'read and display each temperature
   local_ext_temp   = val(tempr$(temp_pin,ext_sensor_id$))
   flow_temp = val(tempr$(temp_pin,ch_sensor_id$) )
   disp_temp c4,r3,flow_temp  
   ret_temp  = val(tempr$(temp_pin,ret_sensor_id$))
   disp_temp c4,r4,ret_temp 
   hw_temp   = val(tempr$(temp_pin,hw_sensor_id$) )
   disp_temp c4,r2,hw_temp
'ask for the next time
ret$ = tempr$(temp_pin,0) 'request all readings, also once in startup
return
michaelvrba72
Posts: 3
Joined: Sat Mar 02, 2024 1:32 am
Has thanked: 6 times
Been thanked: 1 time

Re: Multitasking ?

Post by michaelvrba72 »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Jan 30, 2023 10:23 am
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Jan 27, 2023 5:30 pm Any chance we might see it for 8266 as well?
I'll try to include the changes also in the ESP8266
How was the implementation in 8266? That's what I'm struggling with here, and asynchronous mode would be a good solution, which unfortunately isn't available yet.
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Multitasking ?

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Mar 29, 2024 8:08 am
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Jan 30, 2023 10:23 am
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Jan 27, 2023 5:30 pm Any chance we might see it for 8266 as well?
I'll try to include the changes also in the ESP8266
How was the implementation in 8266? That's what I'm struggling with here, and asynchronous mode would be a good solution, which unfortunately isn't available yet.
It is still not implemented in the ESP8266 and I strongly suggest to move toward the ESP32
BeanieBots
Posts: 361
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 197 times
Been thanked: 115 times

Re: Multitasking ?

Post by BeanieBots »

It would be really nice to have it for the 8266.
Using an ESP32 just to read a few sensors is simply overkill.
Not to mention implementation on existing hardware.
Pretty please :P
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Multitasking ?

Post by cicciocb »

Try again the 1.49, it could work now
michaelvrba72
Posts: 3
Joined: Sat Mar 02, 2024 1:32 am
Has thanked: 6 times
Been thanked: 1 time

Re: Multitasking ?

Post by michaelvrba72 »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Mar 29, 2024 7:15 pm Try again the 1.49, it could work now
How exactly is this supposed to work for version 1.49 of 21/03/2024 19:08? I would expect version 1.50... maybe...
Heartfelt thanks for taking the time to do this!
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Multitasking ?

Post by cicciocb »

Sorry, I forgot to upload :D

Try the latest 1.50 and let me know because I didn't tested
michaelvrba72
Posts: 3
Joined: Sat Mar 02, 2024 1:32 am
Has thanked: 6 times
Been thanked: 1 time

Re: Multitasking ?

Post by michaelvrba72 »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sat Mar 30, 2024 10:21 am Sorry, I forgot to upload :D

Try the latest 1.50 and let me know because I didn't tested
BEAUTIFUL HOPE! It looks functional according to the log dump.
283425d32519012d start...
94 - START
113 - WAIT
230 - WAIT
347 - WAIT
464 - WAIT
581 - WAIT
698 - WAIT
815 - WAIT
932 - 22.625
1076 - 22.625
1220 - 22.625
1364 - 22.625
1508 - 22.625
1652 - 22.625
1796 - 22.625
konec zvonec.

Thank you for the others and have a nice Easter!
Honor your work! :D
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Multitasking ?

Post by cicciocb »

Good news, so.

Happy Easter to you too.
Post Reply