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

Convert bluetooth to MSGs with severity levels #90

Closed
wants to merge 1 commit into from

Conversation

Mimoja
Copy link
Member

@Mimoja Mimoja commented Mar 24, 2021

Signed-off-by: Mimoja [email protected]

@jeffsf can I ask you to have a look?

Copy link
Contributor

@jeffsf jeffsf left a comment

Choose a reason for hiding this comment

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

Great work!

I went cross-eyed trying to keep it all in perspective. I've got a few different opinions, but they're opinions.

I think that no matter what we do, we'll find reasons to adjust in the future. Getting these trimmed down enough so that normal users can run logging all the time at a moderate level (probably NOTICE and up) will, I think, help us all.

@@ -117,7 +114,7 @@ proc skale_timer_start {} {
}

if {[ifexists ::sinstance($::de1(suuid_skale))] == ""} {
msg "Skale not connected, cannot start timer"
msg -WARNING "Skale not connected, cannot start timer"
Copy link
Contributor

@jeffsf jeffsf Mar 25, 2021

Choose a reason for hiding this comment

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

My first instinct was "these get called even when the device isn't connected". Rational thought overtook that quickly with "the test should happen before they are called."

I agree, just noting my thoughts

@@ -383,7 +380,7 @@ proc hiroia_parse_response { value } {
}
::device::scale::process_weight_update [expr $weight / 10.0] ;# $event_time
} else {
error "weight non exist"
msg -ERROR "weight non exist"
Copy link
Contributor

Choose a reason for hiding this comment

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

"Hiroia Jimmy Scale weight update did not provide weight"

@@ -573,7 +568,7 @@ proc decentscale_enable_notifications {} {
}

if {[ifexists ::sinstance($::de1(suuid_decentscale))] == ""} {
msg "decent scale not connected, cannot enable weight notifications"
msg -WARNING "decent scale not connected, cannot enable weight notifications"
Copy link
Contributor

Choose a reason for hiding this comment

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

Lots to check, but if consistently "Decent Scale" or whatever, makes grep easier to use.

Getting the logs trimmed down is such a huge step already. Thanks!

@@ -1005,7 +975,7 @@ proc ble_connect_to_de1 {} {

if {$::de1(device_handle) != "0"} {
catch {
msg "disconnecting from DE1"
msg -INFO "disconnecting from DE1"
Copy link
Contributor

Choose a reason for hiding this comment

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

For me, "high-level" connect/disconnect is interesting enough, especially for the support team, for NOTICE

@@ -1021,13 +991,13 @@ proc ble_connect_to_de1 {} {
set ::de1_name "DE1"
if {[catch {
set ::currently_connecting_de1_handle [ble connect [string toupper $::settings(bluetooth_address)] de1_ble_handler false]
msg "Connecting to DE1 on $::settings(bluetooth_address)"
msg -INFO "Connecting to DE1 on $::settings(bluetooth_address)"
Copy link
Contributor

Choose a reason for hiding this comment

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

High-level connect/disconnect; NOTICE suggested

msg "fw request to erase sent"
#msg "fw request to erase sent, now starting send"
#write_firmware_now
msg -INFO "fw request to erase sent"
Copy link
Contributor

Choose a reason for hiding this comment

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

NOTICE?

firmware_upload_next
} else {
msg "MMR write ack: [string length $value] bytes: [convert_string_to_hex $value ] : $value : [array get arr2]"
msg -INFO "MMR write ack: [string length $value] bytes: [convert_string_to_hex $value ] : $value : [array get arr2]"
Copy link
Contributor

Choose a reason for hiding this comment

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

DEBUG?

} else {
msg "Confirmed wrote to $cuuid of DE1: '$value'"
msg -INFO "Confirmed wrote to $cuuid of DE1: '$value'"
Copy link
Contributor

Choose a reason for hiding this comment

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

DEBUG?

}
} elseif {$address == $::settings(scale_bluetooth_address)} {
msg "Confirmed wrote to $cuuid of $::settings(scale_type): '$value'"
msg -INFO "Confirmed wrote to $cuuid of $::settings(scale_type): '$value'"
Copy link
Contributor

Choose a reason for hiding this comment

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

DEGUB?

} else {
msg "Confirmed wrote to $cuuid of unknown device: '$value'"
msg -INFO "Confirmed wrote to $cuuid of unknown device: '$value'"
Copy link
Contributor

Choose a reason for hiding this comment

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

WARNING -- code probably shouldn't reach this line and if it does, we should fix it

@jeffsf
Copy link
Contributor

jeffsf commented Apr 13, 2021

The set of questions around what level to report attempts to communicate with a device that isn't connected still have me shifting back and forth.

I finally came down to the effort in fixing the code wasn't worth it, nor was alarming users with a WARNING as a result of the code's higher level logic not checking that the device was connected before making a request.

Mimoja pushed a commit that referenced this pull request Apr 15, 2021
First pass at assigning reasonable severituy codes for msg in

  bluetooth.tcl
  de1_comms.tcl
  gui.tcl
  utils.tcl

Commented-out msg lines removed

Converted one "gated" comms_msg to msg

No work done to ensure that no binary data is being logged.

Logging of add_de1_image removed as per discussion with John
load_font completion retained at DEBUG level at this time

These severities are likely to change in future commits,
but need to get at least a first-cut at usability.

Efforts of Mimoja are included in this commit, see
#90

Signed-Off-By: Jeff Kletsky <[email protected]>
@Mimoja Mimoja closed this Apr 16, 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.

2 participants