Skip to content

Commit

Permalink
widdst 0.05: Tweaks to ensure Gadgetbridge can't overwrite timezone o…
Browse files Browse the repository at this point in the history
…n 2v19.106 and later
  • Loading branch information
gfwilliams committed Dec 19, 2023
1 parent e8928e0 commit ba082f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion apps/widdst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.01: Initial version
0.02: Checks for correct firmware; E.setDST(...) moved to boot.js
0.03: Convert Yes/No On/Off in settings to checkboxes
0.04: Give the boot file the highest priority to ensure it runs before sched (fix #2663)
0.04: Give the boot file the highest priority to ensure it runs before sched (fix #2663)
0.05: Tweaks to ensure Gadgetbridge can't overwrite timezone on 2v19.106 and later
26 changes: 13 additions & 13 deletions apps/widdst/boot.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(() => {

if (E.setDST) {
var dstSettings = require('Storage').readJSON('widdst.json',1)||{};
if (dstSettings.has_dst) {
E.setDST(60*dstSettings.dst_size, 60*dstSettings.tz, dstSettings.dst_start.dow_number, dstSettings.dst_start.dow,
dstSettings.dst_start.month, dstSettings.dst_start.day_offset, 60*dstSettings.dst_start.at,
dstSettings.dst_end.dow_number, dstSettings.dst_end.dow, dstSettings.dst_end.month, dstSettings.dst_end.day_offset,
60*dstSettings.dst_end.at);
} else {
E.setDST(0,0,0,0,0,0,0,0,0,0,0,0);
}
if (E.setDST) {
let dstSettings = require('Storage').readJSON('widdst.json',1)||{};
if (dstSettings.has_dst) {
E.setDST(60*dstSettings.dst_size, 60*dstSettings.tz, dstSettings.dst_start.dow_number, dstSettings.dst_start.dow,
dstSettings.dst_start.month, dstSettings.dst_start.day_offset, 60*dstSettings.dst_start.at,
dstSettings.dst_end.dow_number, dstSettings.dst_end.dow, dstSettings.dst_end.month, dstSettings.dst_end.day_offset,
60*dstSettings.dst_end.at);
/* on 2v19.106 and later, E.setTimeZone overwrites E.setDST so we
manually disable E.setTimeZone here to stop Gadgetbridge resetting the timezone */
E.setTimeZone = function(){};
} else {
E.setDST(0,0,0,0,0,0,0,0,0,0,0,0);
}
}

})()
2 changes: 1 addition & 1 deletion apps/widdst/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "id": "widdst",
"name": "Daylight Saving",
"version":"0.04",
"version":"0.05",
"description": "Widget to set daylight saving rules. Requires Espruino 2v15 or later - see the instructions below for more information.",
"icon": "icon.png",
"type": "widget",
Expand Down

0 comments on commit ba082f6

Please sign in to comment.