revisions

This commit is contained in:
pls.153 2023-08-02 11:11:56 +02:00
parent 05bec3c58b
commit 7713ce57a6
4 changed files with 25 additions and 18 deletions

View file

@ -195,20 +195,7 @@
(qsingle-shot 2000 (lambda () (send-message (x:cc "<b>echo:</b>" (subseq text #.(length ":e")))))))
(progn
(when (x:starts-with "<b>echo:</b>" text)
;; send convenient response containing signal info, position, distance
(let ((pos (getf loc:*positions* (me:from packet)))
(my-pos #+mobile (loc:last-gps-position)
#-mobile nil))
(setf text (format nil "~A~%~%snr: <b>~F</b> rssi: <b>~D</b>~%lat: ~,5F lon: ~,5F~%distance: <b>~:D m</b>"
text
(me:rx-snr packet)
(me:rx-rssi packet)
(if my-pos (first my-pos) "-")
(if my-pos (second my-pos) "-")
(if (and pos my-pos)
(loc:distance (cons (first my-pos) (second my-pos))
(cons (getf pos :lat) (getf pos :lon)))
"-")))))
(setf text (msg:echo-message text (me:from packet) (me:rx-snr packet) (me:rx-rssi packet))))
(msg:add-message
(list :receiver (my-name)
:sender (node-to-name (me:from packet))

View file

@ -107,3 +107,20 @@
(format s "<font color='red'>~A</font>"
(subseq text e (+ e len)))))))
(defun echo-message (text from snr rssi)
"Meant for radio signal testing: one static node (with GPS module), while
another mobile node is moving to different places (using GPS of phone),
sending an ':e ...' text message, which will be echoed with info about signal
strength, position and distance."
(let ((from-pos (getf loc:*positions* from))
(my-pos #+mobile (loc:last-gps-position)
#-mobile nil))
(format nil "~A~%~%snr: <b>~F</b> rssi: <b>~D</b>~%lat: ~,5F lon: ~,5F~%distance: <b>~:D m</b>"
text snr rssi
(if my-pos (first my-pos) "-")
(if my-pos (second my-pos) "-")
(if (and from-pos my-pos)
(loc:distance (cons (first my-pos) (second my-pos))
(cons (getf from-pos :lat) (getf from-pos :lon)))
"-"))))

View file

@ -77,6 +77,7 @@
#:change-state
#:check-utf8-length
#:clear-find
#:echo-message
#:find-text
#:message-press-and-hold
#:receiver-changed

View file

@ -85,9 +85,11 @@ Rectangle {
}
}
}
move(index, to, 1)
view.currentIndex = to
view.positionViewAtIndex(to, ListView.Contain)
if (to !== -1) {
move(index, to, 1)
view.currentIndex = to
view.positionViewAtIndex(to, ListView.Contain)
}
}
function radioNames() {
@ -186,7 +188,7 @@ Rectangle {
readOnly = true
if (text === "") text = qsTr("Anonym")
group.setProperty(index, "customName", text)
group.sortRenamed(text, index)
Qt.callLater(group.sortRenamed, text, index)
Lisp.call("group:name-edited", model.radioName, text)
}
}