1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
|
diff -ura hamclock-4.13.orig/ESPHamClock/ESPHamClock.cpp hamclock-4.13.new/ESPHamClock/ESPHamClock.cpp
--- hamclock-4.13.orig/ESPHamClock/ESPHamClock.cpp 2025-02-06 08:21:22.000000000 -0800
+++ hamclock-4.13.new/ESPHamClock/ESPHamClock.cpp 2025-02-14 10:50:18.235752774 -0800
@@ -462,16 +462,6 @@
NVWriteTZ (NV_DE_TZ, de_tz);
}
- // ask to update if new version available -- never returns if update succeeds
- if (!skip_skip) {
- char nv[50];
- if (newVersionIsAvailable (nv, sizeof(nv)) && askOTAupdate (nv)) {
- if (askPasswd ("upgrade", false))
- doOTAupdate(nv);
- eraseScreen();
- }
- }
-
// init sensors
initBME280();
@@ -923,18 +913,16 @@
} else if (!SHOWING_PANE_0() && dx_info_for_sat && inBox (s, dx_info_b)) {
drawDXSatMenu(s);
} else if (inBox (s, version_b)) {
- char nv[50];
- if (newVersionIsAvailable(nv, sizeof(nv))) {
- if (askOTAupdate (nv) && askPasswd ("upgrade", false))
- doOTAupdate(nv);
- } else {
- eraseScreen();
- tft.setTextColor (RA8875_WHITE);
- tft.setCursor (tft.width()/8, tft.height()/3);
- selectFontStyle (BOLD_FONT, SMALL_FONT);
- tft.print ("You're up to date!"); // match webserver response
- wdDelay(3000);
- }
+ eraseScreen();
+ tft.setTextColor (RA8875_WHITE);
+ tft.setCursor (tft.width()/8, tft.height()/3);
+ selectFontStyle (BOLD_FONT, SMALL_FONT);
+ tft.print("Updates disabled for AUR");
+ tft.setCursor (tft.width()/8, tft.height()/3+40);
+ tft.print(F("If this build is outdated by more than a few days,"));
+ tft.setCursor (tft.width()/8, tft.height()/3+80);
+ tft.print(F("please email fang64@gmail.com."));
+ wdDelay(5000);
initScreen();
} else if (inBox (s, wifi_b)) {
// depends on what is currently displayed
@@ -1223,13 +1211,9 @@
if (!timesUp (&check_t, check_dt) && !force)
return;
- // check for new version and reset timeout
+ // show current version
char line[50];
- bool new_avail = newVersionIsAvailable (line, sizeof(line));
- check_t = millis();
-
- // show current version, but highlight if new version is available
- uint16_t col = new_avail ? RA8875_RED : GRAY;
+ uint16_t col = GRAY;
selectFontStyle (LIGHT_FONT, FAST_FONT);
snprintf (line, sizeof(line), "V%s", hc_version);
uint16_t vw = getTextWidth (line);
diff -ura hamclock-4.13.orig/ESPHamClock/Makefile hamclock-4.13.new/ESPHamClock/Makefile
--- hamclock-4.13.orig/ESPHamClock/Makefile 2025-02-06 08:21:22.000000000 -0800
+++ hamclock-4.13.new/ESPHamClock/Makefile 2025-02-14 10:39:48.277507057 -0800
@@ -43,7 +43,6 @@
Germano-Bold-16.o \
Germano-Bold-30.o \
Germano-Regular-16.o \
- OTAupdate.o \
P13.o \
adif.o \
adif_parser.o \
diff -ura hamclock-4.13.orig/ESPHamClock/OTAupdate.cpp hamclock-4.13.new/ESPHamClock/OTAupdate.cpp
--- hamclock-4.13.orig/ESPHamClock/OTAupdate.cpp 2025-02-06 08:21:22.000000000 -0800
+++ hamclock-4.13.new/ESPHamClock/OTAupdate.cpp 2025-02-14 10:27:18.617318418 -0800
@@ -1,443 +1,9 @@
-/* handle remote firmware updating
+/* stub to report no updates available; auto-update is disabled in AUR build
*/
-#include <ESP8266httpUpdate.h>
-#include <WiFiUdp.h>
-
-
#include "HamClock.h"
-// server path to script that returns the newest version available
-static const char v_page[] = "/version.pl";
-
-// query layout
-#define ASK_TO 60 // ask timeout, secs
-#define Q_Y 40 // question y
-#define C_Y 80 // controls y
-#define LH 30 // line height
-#define FD 7 // font descent
-#define LINDENT 10 // list indent
-#define INFO_Y 150 // first list y
-#define YNBOX_W 120 // Y/N box width
-#define YNBOX_H 40 // Y/N box height
-#define YNBOX_GAP 200 // Y/N boxs gap
-#define NBOX_X 50 // no box x
-#define NBOX_Y C_Y // no box y
-#define YBOX_X (800-NBOX_X-YNBOX_W) // yes box x
-#define YBOX_Y C_Y // yes box y
-#define SCR_W 17 // scroll arrow width
-#define SCR_H 30 // scroll arrow height
-#define SCR_BGAP 5 // scroll arrows box border gap
-#define SCR_UPX (800-SCR_BGAP-SCR_W-5) // scroll up x
-#define SCR_UPY INFO_Y // scroll up top y
-#define SCR_DWX SCR_UPX // scroll down x
-#define SCR_DWY (480-SCR_H-10) // scroll down top y
-
-// install layout
-#define PROG_Y0 100 // progress text y
-#define PROG_DY 45 // progress text line spacing
-#define PBAR_INDENT 30 // left and right progress bar indent
-#define PBAR_Y0 200 // progress bar top
-#define PBAR_H 30 // progress bar height
-#define PBAR_W (800-2*PBAR_INDENT) // progress bar width
-
-/* called by ESPhttpUpdate during download with bytes so far and total.
- */
-static void onProgressCB (int sofar, int total)
-{
- tft.drawRect (PBAR_INDENT, PBAR_Y0, PBAR_W, PBAR_H, RA8875_WHITE);
- tft.fillRect (PBAR_INDENT, PBAR_Y0, sofar*PBAR_W/total, PBAR_H, RA8875_WHITE);
- checkWebServer (true);
-}
-
-
-
-/* return whether a new version is available.
- * if so pass back the name in new_ver[new_verl]
- * default no if error.
- */
bool newVersionIsAvailable (char *new_ver, uint16_t new_verl)
{
- WiFiClient v_client;
- char line[100];
- bool found_newer = false;
-
- Serial.printf ("%s/%s\n", backend_host, v_page);
- if (wifiOk() && v_client.connect (backend_host, backend_port)) {
- resetWatchdog();
-
- // query page
- httpHCGET (v_client, backend_host, v_page);
-
- // skip header
- if (!httpSkipHeader (v_client)) {
- Serial.println ("Version query header is short");
- goto out;
- }
-
- // next line is new version number
- if (!getTCPLine (v_client, line, sizeof(line), NULL)) {
- Serial.println ("Version query timed out");
- goto out;
- }
-
- // non-beta accepts only newer non-beta; beta accepts anything newer
- Serial.printf ("found version %s\n", line);
- float our_v = atof(hc_version);
- float new_v = atof(line);
- bool we_are_beta = strchr (hc_version, 'b') != NULL;
- bool new_is_beta = strchr (line, 'b') != NULL;
- if (we_are_beta) {
- if (new_is_beta) {
- int our_beta_v = atoi (strchr(hc_version,'b') + 1);
- int new_beta_v = atoi (strchr(line,'b') + 1);
- if (new_beta_v > our_beta_v) {
- found_newer = true;
- strncpy (new_ver, line, new_verl);
- }
- } else {
- if (new_v >= our_v) {
- found_newer = true;
- strncpy (new_ver, line, new_verl);
- }
- }
- } else {
- if (!new_is_beta && new_v > our_v) {
- found_newer = true;
- strncpy (new_ver, line, new_verl);
- }
- }
-
- // just log next few lines for debug
- // for (int i = 0; i < 2 && getTCPLine (v_client, line, sizeof(line), NULL); i++)
- // Serial.printf (" %s\n", line);
- }
-
-out:
-
- // finished with connection
- v_client.stop();
-
- return (found_newer);
-}
-
-/* draw as many of the given lines starting with top_line as will fit
- */
-static void drawChangeList (char **line, int top_line, int n_lines)
-{
- uint16_t line_y = INFO_Y;
-
- // erase over to scroll bar
- tft.fillRect (0, line_y, SCR_UPX-SCR_BGAP-1, tft.height() - line_y, RA8875_BLACK);
-
- selectFontStyle (LIGHT_FONT, SMALL_FONT);
- for (int i = top_line; i < n_lines && (line_y += LH) < tft.height() - FD; i++) {
- tft.setCursor (LINDENT, line_y);
- tft.print (line[i]);
- }
-}
-
-
-/* draw or erase an up or down arrow in the given box
- */
-typedef enum {
- DA_UP,
- DA_DOWN
-} DrawArrowDir;
-typedef enum {
- DA_ON,
- DA_OFF
-} DrawArrowOnOff;
-static void drawArrow (const SBox &b, DrawArrowOnOff oo, DrawArrowDir ud)
-{
- // stay within b
- uint16_t b_y = b.y + b.h - 1;
- uint16_t r_x = b.x + b.w - 1;
- uint16_t tip_x = b.x + b.w/2;
-
- if (oo == DA_ON) {
- if (ud == DA_UP)
- tft.fillTriangle (tip_x, b.y, b.x, b_y, r_x, b_y, RA8875_WHITE);
- else
- tft.fillTriangle (tip_x, b_y, b.x, b.y, r_x, b.y, RA8875_WHITE);
- } else {
- fillSBox (b, RA8875_BLACK);
- if (ud == DA_UP)
- tft.drawTriangle (tip_x, b.y, b.x, b_y, r_x, b_y, RA8875_WHITE);
- else
- tft.drawTriangle (tip_x, b_y, b.x, b.y, r_x, b.y, RA8875_WHITE);
- }
-}
-
-/* draw the scale trough
- */
-static void drawTrough (int max_lines, int n_lines, int top_line)
-{
- // erase trough the border and arrows
- uint16_t in_x = SCR_UPX-SCR_BGAP+2;
- uint16_t in_y = SCR_UPY+SCR_H+2;
- uint16_t in_w = SCR_W+2*SCR_BGAP-4;
- uint16_t in_h = SCR_DWY-2 - in_y;
- tft.fillRect (in_x, in_y, in_w, in_h, RA8875_BLACK);
-
- // draw thumb
- uint16_t tr_x = in_x;
- uint16_t tr_y = in_y + (int)top_line * in_h / n_lines;
- uint16_t tr_w = in_w;
- uint16_t tr_h = (int)max_lines * in_h / n_lines;
- tft.fillRect (tr_x, tr_y, tr_w, tr_h, RA8875_WHITE);
-}
-
-/* ask and return whether to install the given (presumably newer) version.
- * default no if trouble of no user response.
- */
-bool askOTAupdate(char *new_ver)
-{
- // prep
- eraseScreen();
- hideClocks();
- selectFontStyle (BOLD_FONT, SMALL_FONT);
- tft.setTextColor (RA8875_WHITE);
- char line[128];
-
- // ask whether to install
- tft.setCursor (LINDENT, Q_Y);
- snprintf (line, sizeof(line), "New version %s is available. Update now? ... ", new_ver);
- tft.print (line);
- uint16_t count_x = tft.getCursorX();
- uint16_t count_y = tft.getCursorY();
- int count_s = ASK_TO;
- tft.print(count_s);
-
- // draw yes/no boxes
- SBox no_b = {NBOX_X, NBOX_Y, YNBOX_W, YNBOX_H};
- SBox yes_b = {YBOX_X, YBOX_Y, YNBOX_W, YNBOX_H};
- bool active_yes = false;
- drawStringInBox ("No", no_b, !active_yes, RA8875_WHITE);
- drawStringInBox ("Yes", yes_b, active_yes, RA8875_WHITE);
-
- // prep for potentially long wait
- closeGimbal();
-
- // read list of changes
- selectFontStyle (LIGHT_FONT, SMALL_FONT);
- WiFiClient v_client;
- char **lines = NULL; // malloced list of malloced strings -- N.B. free!
- int n_lines = 0;
- if (wifiOk() && v_client.connect (backend_host, backend_port)) {
- resetWatchdog();
-
- // query page
- httpHCGET (v_client, backend_host, v_page);
-
- // skip header
- if (!httpSkipHeader (v_client)) {
- Serial.println ("Info header is short");
- goto out;
- }
-
- // skip next line which is new version number
- if (!getTCPLine (v_client, line, sizeof(line), NULL)) {
- Serial.println ("Info timed out");
- goto out;
- }
-
- // remaining lines are changes, add to lines[]
- while (getTCPLine (v_client, line, sizeof(line), NULL)) {
- maxStringW (line, SCR_UPX-SCR_BGAP-LINDENT-1); // insure fit
- lines = (char **) realloc (lines, (n_lines+1) * sizeof(char*));
- lines[n_lines++] = strdup (line);
- }
- }
- out:
- v_client.stop();
-
- // how many will fit
- const int max_lines = (tft.height() - FD - INFO_Y)/LH;
-
- // prep first display of changes
- int top_line = 0;
- drawChangeList (lines, top_line, n_lines);
-
- // scrolling tests
- #define NEED_SCR (n_lines > max_lines)
- #define MORE_UP (NEED_SCR && top_line > 0)
- #define MORE_DOWN (NEED_SCR && top_line < n_lines - max_lines)
-
- // add scroll controls if needed
-
- SBox sup_b;
- sup_b.x = SCR_UPX;
- sup_b.y = SCR_UPY;
- sup_b.w = SCR_W;
- sup_b.h = SCR_H;
- if (NEED_SCR)
- drawArrow (sup_b, MORE_UP ? DA_ON : DA_OFF, DA_UP);
-
- SBox sdw_b;
- sdw_b.x = SCR_DWX;
- sdw_b.y = SCR_DWY;
- sdw_b.w = SCR_W;
- sdw_b.h = SCR_H;
- if (NEED_SCR)
- drawArrow (sdw_b, MORE_DOWN ? DA_ON : DA_OFF, DA_DOWN);
-
- // draw arrows border if needed
- if (NEED_SCR) {
- uint16_t brd_x = SCR_UPX-SCR_BGAP;
- uint16_t brd_y = SCR_UPY-SCR_BGAP;
- uint16_t brd_w = SCR_W+2*SCR_BGAP;
- uint16_t brd_h = SCR_DWY+SCR_H+SCR_BGAP - brd_y;
- tft.drawRect (brd_x, brd_y, brd_w, brd_h, RA8875_WHITE);
- }
-
- // draw scale if needed
- if (NEED_SCR)
- drawTrough (max_lines, n_lines, top_line);
-
- // wait for response or time out
- drainTouch();
- uint32_t t0 = millis();
- Serial.println ("Waiting for update y/n ...");
- bool finished = false;
- bool result = false;
- while (!finished && count_s > 0) {
-
- // check for scroll
- int prev_topl = top_line;
-
- // update countdown
- wdDelay(10);
- if (timesUp(&t0,1000)) {
- selectFontStyle (BOLD_FONT, SMALL_FONT);
- tft.fillRect (count_x, count_y-30, 60, 40, RA8875_BLACK);
- tft.setCursor (count_x, count_y);
- tft.print(--count_s);
- }
-
- // handle typed chars
- switch (tft.getChar(NULL,NULL)) {
- case CHAR_TAB:
- case CHAR_LEFT:
- case CHAR_RIGHT:
- active_yes = !active_yes;
- drawStringInBox ("Yes", yes_b, active_yes, RA8875_WHITE);
- drawStringInBox ("No", no_b, !active_yes, RA8875_WHITE);
- count_s = ASK_TO;
- break;
- case CHAR_ESC:
- finished = true;
- result = false;
- break;
- case CHAR_CR:
- case CHAR_NL:
- finished = true;
- result = active_yes;
- break;
- case CHAR_UP:
- if (MORE_UP)
- drawChangeList (lines, --top_line, n_lines);
- count_s = ASK_TO;
- break;
- case CHAR_DOWN:
- if (MORE_DOWN)
- drawChangeList (lines, ++top_line, n_lines);
- count_s = ASK_TO;
- break;
- }
-
- // handle clicks
- SCoord s;
- if (readCalTouchWS(s) != TT_NONE) {
- if (inBox (s, yes_b)) {
- drawStringInBox ("Yes", yes_b, true, RA8875_WHITE);
- finished = true;
- result = true;
- }
- if (inBox (s, no_b)) {
- drawStringInBox ("No", no_b, false, RA8875_WHITE);
- finished = true;
- result = false;
- }
- if (inBox (s, sup_b)) {
- if (MORE_UP)
- drawChangeList (lines, --top_line, n_lines);
- count_s = ASK_TO;
- }
- if (inBox (s, sdw_b)) {
- if (MORE_DOWN)
- drawChangeList (lines, ++top_line, n_lines);
- count_s = ASK_TO;
- }
- }
-
- // manage scroll arrows
- if (prev_topl != top_line && NEED_SCR) {
- drawArrow (sup_b, MORE_UP ? DA_ON : DA_OFF, DA_UP);
- drawArrow (sdw_b, MORE_DOWN ? DA_ON : DA_OFF, DA_DOWN);
- drawTrough (max_lines, n_lines, top_line);
- }
- }
-
- // clean up
- while (--n_lines >= 0)
- free (lines[n_lines]);
- free (lines);
-
- // return result
- return (result);
-}
-
-/* reload HamClock with the given version.
- * we never return regardless of success or fail.
- */
-void doOTAupdate(const char *newver)
-{
- Serial.println ("Begin download");
-
- // inform user
- eraseScreen();
- selectFontStyle (BOLD_FONT, SMALL_FONT);
- tft.setTextColor (RA8875_WHITE);
- tft.setCursor (0, PROG_Y0);
- tft.printf (" Performing remote update to V%s...", newver);
- tft.setCursor (0, PROG_Y0 + PROG_DY);
- tft.print (" Do not interrupt power or network during this process.");
-
- // connect progress callback
- ESPhttpUpdate.onProgress (onProgressCB);
-
- // build url
- resetWatchdog();
- WiFiClient client;
- char url[200];
- if (strchr(newver, 'b'))
- snprintf (url, sizeof(url), "http://%s/ham/HamClock/ESPHamClock-V%s.zip", backend_host, newver);
- else
- snprintf (url, sizeof(url), "https://%s/ham/HamClock/ESPHamClock.zip", backend_host);
-
- // go
- t_httpUpdate_return ret = ESPhttpUpdate.update(client, url);
- resetWatchdog();
-
- // show error message and exit
- switch (ret) {
- case HTTP_UPDATE_FAILED:
- fatalError ("Update failed: Error %d\n%s\n",
- ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
- break;
-
- case HTTP_UPDATE_NO_UPDATES:
- fatalError ("No updates found");
- break;
-
- case HTTP_UPDATE_OK:
- fatalError ("Update Ok??");
- break;
-
- default:
- fatalError ("Unknown failure code: ");
- tft.println (ret);
- break;
- }
+ return false;
}
diff -ura hamclock-4.13.orig/ESPHamClock/webserver.cpp hamclock-4.13.new/ESPHamClock/webserver.cpp
--- hamclock-4.13.orig/ESPHamClock/webserver.cpp 2025-02-06 08:21:22.000000000 -0800
+++ hamclock-4.13.new/ESPHamClock/webserver.cpp 2025-02-14 10:37:33.416619442 -0800
@@ -3724,23 +3724,8 @@
*/
static bool doWiFiUpdate (WiFiClient &client, char *unused_line, size_t line_len)
{
- (void)(unused_line);
- (void)(line_len);
-
- // prep for response but won't be one if we succeed with update
startPlainText(client);
-
- // proceed if newer version is available
- char ver[100];
- if (newVersionIsAvailable (ver, sizeof(ver))) {
- char msg[200];
- snprintf (msg, sizeof(msg), "updating from %s to %s ... \n", hc_version, ver);
- client.print(msg);
- doOTAupdate(ver); // never returns if successful
- client.println ("update failed");
- } else
- client.println ("You're up to date!"); // match tapping version
-
+ client.println("Updates disabled for AUR; if this build is outdated by more than a few days, please email fang64@gmail.com.");
return (true);
}
diff -ura hamclock-4.13.orig/ESPHamClock/wifi.cpp hamclock-4.13.new/ESPHamClock/wifi.cpp
--- hamclock-4.13.orig/ESPHamClock/wifi.cpp 2025-02-06 08:21:22.000000000 -0800
+++ hamclock-4.13.new/ESPHamClock/wifi.cpp 2025-02-14 10:47:39.565156174 -0800
@@ -383,8 +383,8 @@
if (WiFi.status() == WL_CONNECTED) {
// just to get remote_addr
- char line[50];
- (void)newVersionIsAvailable (line, sizeof(line));
+ // char line[50];
+ // (void)newVersionIsAvailable (line, sizeof(line));
IPAddress ip = WiFi.localIP();
tftMsg (verbose, 0, "Local IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|