Make top edge repeat grid selection

master
Tanner Collin 10 months ago
parent 9edab1f230
commit 87f93e10d1
  1. 21
      antonclk/antonclk.app.js

@ -23,6 +23,7 @@ Graphics.prototype.setFontAnton = function(scale) {
let grid = ["Office off", "Office 1/2", "Office on", "Kitchen off", "Kitchen 1/2", "Kitchen on", "Window off", "Window 1/2", "Window on", "LStairs off", "LStairs 1/2", "LStairs on", "Nook off", "Nook 1/2", "Nook on", "SideEnt off", "SideEnt 1/2", "SideEnt on", "Theatre off", "Theatre 1/2", "Theatre on", "FPot off", "FPot 1/2", "FPot on", "SPot off", "SPot 1/2", "SPot on", "GuestBth off", "GuestBth 1/2", "GuestBth on"];
let gridNum = -1;
let prevNum = -1;
let gridDir = -1;
let paintFace = function() {
@ -120,7 +121,7 @@ Graphics.prototype.setFontAnton = function(scale) {
text = "right";
gridDir = "right";
} else if (truncY < 2) {
text = "top";
text = "Repeat";
gridDir = "top";
} else if (truncY > 10) {
text = "Cancel";
@ -168,6 +169,7 @@ Graphics.prototype.setFontAnton = function(scale) {
if (gridNum >= 0 && grid[gridNum]) {
myMessage = grid[gridNum];
prevNum = gridNum;
if (Bangle.http){
const options = {timeout:3000, method: "post", body: gridNum};
@ -180,6 +182,23 @@ Graphics.prototype.setFontAnton = function(scale) {
});
}
gridNum = -1;
} else if (gridDir == "top") {
if (prevNum >= 0) {
myMessage = grid[prevNum];
if (Bangle.http){
const options = {timeout:3000, method: "post", body: prevNum};
Bangle.http("https://api.home.dns.t0.vc/grid", options).then(event => {
myMessage = "ok"
if (paintFace) paintFace();
}).catch((e)=>{
myMessage = "POST error";
if (paintFace) paintFace();
});
}
} else {
myMessage = "No repeat";
}
} else if (gridDir == "bottom") {
myMessage = "Cancelled";
Bangle.setLocked(true);

Loading…
Cancel
Save