Skip to content

Commit

Permalink
good good
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Jul 3, 2024
1 parent 389dd2c commit bcd30ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions services/pixljs_alert/pixljs_ble.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Graphics.prototype.setFontPixeloidSans = function(scale) {
);
};
g.setFontPixeloidSans(1);
require("FontDennis8").add(Graphics);

NRF.on('connect', function(addr) {
// Update this property when connected in bluetooth
Expand Down Expand Up @@ -125,6 +124,13 @@ function switchStateInstall(newMode) {
repeat: false,
debounce: 10
});
if (timeout_reset > 0) {
try {
clearTimeout(timeout_reset);
} catch (e) {
//ignore
}
}
}
installScreen();
if (mode) {
Expand Down Expand Up @@ -197,14 +203,13 @@ function questionBDrawScreen() {
function installScreen() {
if (mode == 1) {
g.clear();
g.setFont("Dennis8");
g.setFontAlign(0.5, -1);
let text = "Installation mode\nPixl.js " + NRF.getAddress().substr(12, 5).replace(":", "")+"\n";
let diff = Date().valueOf() - lastSeen.valueOf();
if (diff > TIMEOUT_RPI) {
text += "No Rpi Connection";
} else {
text += "Vu il y a " + parseInt(diff / 1000) + " secondes\nRSSI: " + rssi + " dB (" + rssiPowerHint() + ")";
text += parseInt(diff / 1000) + " s à " + rssi + " dB (" + rssiPowerHint() + ")";
}
let t = g.stringMetrics(text);
g.drawString(text, g.getWidth() / 2, 0);
Expand Down Expand Up @@ -418,7 +423,6 @@ function installResetTimeout() {

function screenQuestionA() {
installResetTimeout();
g.setFontPixeloidSans(1);
mode = 2;
currentForm = [];
Pixl.setLCDPower(true);
Expand Down Expand Up @@ -490,7 +494,6 @@ function screenIdle() {
Pixl.setLCDPower(true);
LED.write(1);
g.clear();
g.setFontPixeloidSans(1);
g.setFontAlign(1, -1);
g.drawString("Un passage m'a gêné>\naccéder au questionnaire", g.getWidth(), 0);
g.setFontAlign(1, 1);
Expand Down
4 changes: 2 additions & 2 deletions services/pixljs_alert/zero_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def get_rpi_status():
break
with GPSDClient() as client:
for result in client.dict_stream(convert_datetime=True, filter=["TPV"]):
gpdsdout = "%.5s %.5s" % (result.get("lat", "n/a"), result.get("lon", "n/a"))
gpdsdout = "%.7s %.7s" % (result.get("lat", "n/a"), result.get("lon", "n/a"))
break
rpi_status = "Mic: %.25s\\nVpn: %.25s\\nBat: %.25s\\nGps: %.25s" % (mic, vpn, battery, gpdsdout)
rpi_status = "Mic: %.20s\\nVpn: %.20s\\nBat: %.20s\\nGps: %.20s" % (mic, vpn, battery, gpdsdout)
return rpi_status.encode("iso-8859-1")


Expand Down

0 comments on commit bcd30ab

Please sign in to comment.