-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add MEATER support #120
Conversation
214e661
to
844b990
Compare
@@ -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 } { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 }]}
de1plus/bluetooth.tcl
Outdated
### MISC | ||
|
||
proc process_temperature_value {value} { | ||
if {$::de1(substate) == $::de1_substate_types_reversed("Steaming")} { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
Signed-off-by: Mimoja <[email protected]>
Is this ready for me to review, or still needing you to re-merge @Mimoja ? |
Ready for review, works with latest nightly, knock yourself out :3 |
Signed-off-by: Mimoja [email protected]