mirror of
https://github.com/wisplite/parchment.git
synced 2026-06-27 13:47:08 -05:00
Refactor UI state management and improve error handling in the application. Added success and error messages to enhance user feedback during package creation and device connection status updates.
This commit is contained in:
@@ -68,13 +68,18 @@ func (d *Device) Connect() error {
|
||||
|
||||
// ExitDevMode sends the command to exit dev mode.
|
||||
func (d *Device) ExitDevMode() error {
|
||||
if !d.Connected || d.Port == nil {
|
||||
return fmt.Errorf("device not connected")
|
||||
if d.Port == nil {
|
||||
return fmt.Errorf("port not open")
|
||||
}
|
||||
|
||||
// Send exit dev mode command
|
||||
// TODO: Replace with the actual command sequence to exit dev mode
|
||||
// This is currently not implemented on the Cardputer side.
|
||||
// disable dev mode
|
||||
_, err := d.Port.Write([]byte{0xAA, 0x05, 0x00, 0x00, 0x00})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to send exit dev mode command: %w", err)
|
||||
}
|
||||
|
||||
// Allow some time for the device to respond or settle if needed
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user