Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MEATER support #120

Merged
merged 1 commit into from
May 19, 2021
Merged

Add MEATER support #120

merged 1 commit into from
May 19, 2021

Conversation

Mimoja
Copy link
Member

@Mimoja Mimoja commented Apr 14, 2021

Signed-off-by: Mimoja [email protected]

@Mimoja Mimoja force-pushed the thermometer branch 4 times, most recently from 214e661 to 844b990 Compare April 14, 2021 17:21
de1plus/bluetooth.tcl Show resolved Hide resolved
@@ -1373,17 +1462,29 @@ proc de1_ble_handler { event data } {

de1_connect_handler $handle $address "DE1"

if {$::de1(scale_device_handle) != 0} {
if {$::de1(scale_device_handle) != 0 && $::de1(thermometer_device_handle) != 0 } {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a higher level, does it make sense to have a "check for" list somewhere so that the scanner can be stopped, at least at boot? Maybe stop if started from boot (or wake) if configured devices are all found?

I haven't watched in a lot of detail, but it seems that at least DSx dumps the whole set of shot frames and settings onto the BLE queue at load time, often even before the DE1 is connected. Maybe that's a different problem to resolve.

binary scan $value a2 raw
set temp [expr $raw / 16]

msg "Meater temperature is $temp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully PR #114 (Logging for v1.35) will be merged soon.

Would it be reasonable to put the MEATER-specific code into ::device::meater in device_meater.tcl or something similar?

This msg -DEBUG makes sense for early development, but probably needs a flag to disable or to be removed later on.

Passing in event_time, even if unused, means that later processing can know when the packet arrived for processing. Depending on how much is inline code of the handlers from previous packets, it can be delayed by 100-250 ms or more. I didn't convert all of the existing calls in bluetooth.tcl due to the number of changes. Right now, it's on a packet-by-packet basis, but I can definitely see puling events off the ble callback and onto the event queue if I can't get potentially slow things like skins_page_change_due_to_de1_state_change out of the BLE handler and onto the appropriate queue.

(Reminds me to try to get that onto an event. When I last tried, the GUI failed to render. Hmmm, now it works.)

(and you ruin a coffee because the timestamp fetch is done blocking and locks up the machine for 30 seconds)

In bluetooth.tcl:

   1194 proc de1_ble_handler { event data } {
   1195         #msg "de1 ble_handler '$event' [convert_string_to_hex $data]"
   1196         #set ::de1(wrote) 0
   1197 
   1198         set event_time [expr { [clock milliseconds] / 1000.0 }]

In device_scale.tcl:

    193         proc process_weight_update {reported_weight {event_time 0}} {
    194 
    195                 if { $event_time == 0 } {set event_time [expr { [clock milliseconds] / 1000.0 }]}

### MISC

proc process_temperature_value {value} {
if {$::de1(substate) == $::de1_substate_types_reversed("Steaming")} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

if { [::de1::state::current_state] == "Steam" && [::de1::state::current_substate] == "Steaming" }

or just the second clause if you feel lucky.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it. thanks!

proc process_temperature_value {value} {
if {$::de1(substate) == $::de1_substate_types_reversed("Steaming")} {
if {$value >= $::settings(target_milk_temperature)} {
start_idle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help prevent puzzles
msg -NOTICE [format "Steaming stopped for temperature at %.1f for target %.1f" $value $::settings(target_milk_temperature)

@Mimoja Mimoja marked this pull request as ready for review May 6, 2021 09:32
Signed-off-by: Mimoja <[email protected]>
@decentjohn
Copy link
Contributor

Is this ready for me to review, or still needing you to re-merge @Mimoja ?

@Mimoja
Copy link
Member Author

Mimoja commented May 14, 2021

Ready for review, works with latest nightly, knock yourself out :3

@Mimoja Mimoja merged commit 271f018 into decentespresso:main May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants