diff --git a/examples/meshtastic/cpp/ble.cpp b/examples/meshtastic/cpp/ble.cpp index f9d57fb..b08a3ea 100644 --- a/examples/meshtastic/cpp/ble.cpp +++ b/examples/meshtastic/cpp/ble.cpp @@ -153,6 +153,7 @@ void BLE::retryScan() { void BLE::errorReceived(QLowEnergyController::Error) { qDebug() << "BLE error: " << controller->errorString(); + Q_EMIT bleError(); } void BLE::disconnectFromDevice() { diff --git a/examples/meshtastic/cpp/ble.h b/examples/meshtastic/cpp/ble.h index 8b4215e..efa712a 100644 --- a/examples/meshtastic/cpp/ble.h +++ b/examples/meshtastic/cpp/ble.h @@ -36,6 +36,7 @@ Q_SIGNALS: void deviceDiscovered(const QString&); void mainServiceReady(); void deviceDisconnecting(); + void bleError(); public Q_SLOTS: void startDeviceDiscovery(); diff --git a/examples/meshtastic/cpp/qt.cpp b/examples/meshtastic/cpp/qt.cpp index 4365fca..697b58f 100644 --- a/examples/meshtastic/cpp/qt.cpp +++ b/examples/meshtastic/cpp/qt.cpp @@ -29,6 +29,10 @@ QT::QT() : QObject() { [](const QString& fullName) { ecl_fun("radios:device-discovered", fullName.right(4)); }); + ble->connect(ble, &BLE::bleError, + []() { + ecl_fun("radios:reset-default-radio"); + }); } // BLE_ME diff --git a/examples/meshtastic/lisp/lora.lisp b/examples/meshtastic/lisp/lora.lisp index ad81c52..dde6bca 100644 --- a/examples/meshtastic/lisp/lora.lisp +++ b/examples/meshtastic/lisp/lora.lisp @@ -173,18 +173,18 @@ (case (me:portnum decoded) ;; text-message (:text-message-app - (let ((timestamp (get-universal-time)) ; or (me:rx-time packet) ? + (let ((timestamp (get-universal-time)) (mid (me:id packet)) (text (qfrom-utf8 payload))) (setf msg:*message-id* (max mid msg:*message-id*)) - (if (x:starts-with ":echo" text) - (send-message (x:cc "echo:" (subseq text #.(length ":echo")))) + (if (x:starts-with ":e" text) ; 'echo' + (qsingle-shot 1000 (lambda () (send-message (x:cc "echo:" (subseq text #.(length ":e")))))) (progn - (when (x:starts-with "echo:" text) + (when (x:starts-with "echo:" text) ;; send convenient response containing signal info, position, distance (let ((pos (getf loc:*positions* (me:from packet))) (my-pos (loc:last-gps-position))) - (setf text (format nil "~A~%~%snr: ~F rssi: ~D~%lat: ~F lon: ~F~%distance: ~:D" + (setf text (format nil "~A~%~%snr: ~F rssi: ~D~%lat: ~F lon: ~F~%distance: ~:D m" text (me:rx-snr packet) (me:rx-rssi packet) diff --git a/examples/meshtastic/lisp/messages.lisp b/examples/meshtastic/lisp/messages.lisp index 1ea5c1a..8c51a77 100644 --- a/examples/meshtastic/lisp/messages.lisp +++ b/examples/meshtastic/lisp/messages.lisp @@ -45,7 +45,8 @@ (q! |clear| ui:*messages*) (dolist (message (db:load-messages (parse-integer x:it :radix 16))) (add-message (read-from-string message) t)) - (qsingle-shot 100 (lambda () (q! |positionViewAtEnd| ui:*message-view*))))) + (dotimes (n 2) ; Qt bug + (q! |positionViewAtEnd| ui:*message-view*)))) (defun receiver-changed () (qsleep 0.1) diff --git a/examples/meshtastic/lisp/package.lisp b/examples/meshtastic/lisp/package.lisp index aa544ea..fda5cfd 100644 --- a/examples/meshtastic/lisp/package.lisp +++ b/examples/meshtastic/lisp/package.lisp @@ -90,7 +90,6 @@ #:change-radio #:clear #:device-discovered - #:reset-configured #:reset-default-radio)) (defpackage :location diff --git a/examples/meshtastic/lisp/radios.lisp b/examples/meshtastic/lisp/radios.lisp index 47d7333..61d6fe6 100644 --- a/examples/meshtastic/lisp/radios.lisp +++ b/examples/meshtastic/lisp/radios.lisp @@ -28,5 +28,6 @@ (defun reset-default-radio () ;; TODO: add in UI settings - (app:change-setting :device nil)) + (app:change-setting :device nil) + (lora:start-device-discovery)) diff --git a/examples/meshtastic/readme-usage.md b/examples/meshtastic/readme-usage.md index f04839b..e5948ad 100644 --- a/examples/meshtastic/readme-usage.md +++ b/examples/meshtastic/readme-usage.md @@ -101,19 +101,21 @@ your radio, just press-and-hold on the **Group** icon. Both of above is meant to avoid app restart. -For a trivial signal test you can use the special command **:echo**, which will -send back the text you sent, adding signal snr/rssi, position, distance. This -is convenient to test signal strength from different places, and have it logged -in your messages. +For a trivial signal test you can use the special command **:e** (for 'echo'), +which will send back the text you sent, adding signal snr/rssi, position and +distance. This is convenient to test signal strength from different places, and +have it logged in your messages. Hacker tips ----------- If it occurs that a RAK device goes into an undefined state and doesn't seem -to work anymore, you can try to reset the flash memory from an arduino IDE, -see the RAK github and file `reset-flash.ino`. I successfully recovered a -RAK device with corrupted memory using this method. +to work anymore, you can try a factory reset (see CLI) and flash the latest +firmware. + +Alternatively you can completely erase the flash memory from an arduino IDE, +see RAK on github and file `reset-flash.ino` (re-flash firmware afterwards). If you are a Lisp hacker, you may enjoy the integrated Swank server (on mobile). Just type `:s` as your text message. A message with the IP to connect