-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHamClock.h
919 lines (688 loc) · 20.9 KB
/
HamClock.h
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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
/* HamClock glue
*/
#ifndef _HAMCLOCK_H
#define _HAMCLOCK_H
// handy build categories
#if defined(_USE_X11) || defined(_USE_FB0)
#define _USE_DESKTOP
#endif
#if defined(__linux__) || defined(__APPLE__)
#define _USE_UNIX
#endif
#if defined(__arm__) && defined(__linux__)
#define _IS_RPI
#endif
#if defined(ESP8266)
#define _IS_ESP8266
#endif
// UNIX-like modules
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
// see Adafruit_RA8875.h
#define USE_ADAFRUIT_GFX_FONTS
// community modules
#include <TimeLib.h>
#include <ESP8266WiFi.h>
#include <IPAddress.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include "Adafruit_RA8875_R.h"
// HamClock modules
#include "calibrate.h"
#include "version.h"
#include "P13.h"
/*********************************************************************************************
*
* ESPHamClock.ino
*
*/
extern const char svr_host[];
// screen coordinates, upper left at [0,0]
typedef struct {
uint16_t x, y;
} SCoord;
// screen coords of box ul and size
typedef struct {
uint16_t x, y, w, h;
} SBox;
// screen center, radius
typedef struct {
SCoord s;
uint16_t r;
} SCircle;
// timezone info
typedef struct {
SBox box;
uint16_t color;
int32_t tz_secs;
} TZInfo;
// map lat, lng, + radians N and E
typedef struct {
float lat, lng; // radians north, east
float lat_d, lng_d; // degrees
} LatLong;
#define LIFE_LED 0
#define DE_INFO_ROWS 3
#define DX_INFO_ROWS 5
extern Adafruit_RA8875_R tft;
extern TZInfo de_tz, dx_tz;
extern SBox NCDXF_b;
extern SBox brightness_b;
#define PLOT1_H 149
#define PLOT2_H 149
#define PLOT3_H 149
extern SBox plot1_b, plot2_b, plot3_b;
extern SBox sensor_b;
extern SBox clock_b;
extern SBox rss_bnr_b;
extern SBox rss_btn_b;
extern uint8_t rss_on;
extern SBox desrss_b, dxsrss_b;
extern uint8_t desrss, dxsrss;
enum {
DXSRSS_INAGO,
DXSRSS_ATAT,
DXSRSS_PREFIX,
DXSRSS_N,
};
// show NCDXF beacons or up to one of two brightness controls, depending on model
extern uint8_t brb_mode;
typedef enum {
BRB_SHOW_BEACONS,
BRB_SHOW_BRCLOCK,
BRB_SHOW_BRCTRL,
BRB_SHOW_NOTHING
} BRB_MODE;
extern uint8_t plot1_ch, plot2_ch, plot3_ch;
extern SBox azm_btn_b;
extern uint8_t azm_on;
extern SBox llg_btn_b;
extern uint8_t llg_on;
extern SBox dx_info_b;
extern SBox satname_b;
extern SBox de_info_b;
extern SBox map_b;
extern SBox dx_maid_b;
extern SBox de_maid_b;
extern SBox lkscrn_b;
#define RSS_BG_COLOR RGB565(0,40,80) // RSS banner background color
#define RSS_FG_COLOR RA8875_WHITE // RSS banner text color
extern uint8_t azimuthal_mode;
extern SBox azmmode_b;
extern char *stack_start;
enum {
LLG_OFF,
LLG_TROPICS,
LLG_ALL
};
#define MAX_PREF_LEN 4 // maximumm prefix length
extern void drawDXTime(void);
extern void drawDXMarker(bool force);
extern void drawAllSymbols(bool erase_too);
extern void drawTZ(const TZInfo &tzi);
extern bool inBox (const SCoord &s, const SBox &b);
extern bool inCircle (const SCoord &s, const SCircle &c);
extern void tftMsg (const char *fmt, ...);
extern void reboot(void);
extern void printFreeHeap (const __FlashStringHelper *label);
extern void getWorstMem (int *heap, int *stack);
extern void resetWatchdog(void);
extern void wdDelay(int ms);
extern bool timesUp (uint32_t *prev, uint32_t dt);
extern void setDXPathInvalid(void);
extern void drawRSSButton(void);
extern bool overMap (const SCoord &s);
extern bool overAnySymbol (const SCoord &s);
extern bool overRSS (const SCoord &s);
extern bool overRSS (const SBox &b);
extern void drawAzmMercButton (void);
extern void setAzmMerc(bool on);
extern void drawLLGridButton (void);
extern void changeLLGrid(void);
extern void newDE (LatLong &ll);
extern void newDX (LatLong &ll, const char *override_prefix);
extern void roundLL (LatLong &ll);
extern void getTextBounds (char str[], uint16_t *wp, uint16_t *hp);
extern uint16_t getTextWidth (char str[]);
extern void normalizeLL (LatLong &ll);
extern bool screenIsLocked(void);
extern time_t getUptime (uint16_t *days, uint8_t *hrs, uint8_t *mins, uint8_t *secs);
extern void eraseScreen(void);
extern void drawMapTag (char *tag, uint16_t x, uint16_t y, uint16_t r, SBox &box);
extern void setDXPrefixOverride (char p[MAX_PREF_LEN]);
extern bool getDXPrefix (char p[MAX_PREF_LEN+1]);
/*********************************************************************************************
*
* OTAupdate.cpp
*
*/
extern bool isNewVersionAvailable (char *nv, uint16_t nvl);
extern bool askOTAupdate(char *ver);
extern void doOTAupdate(void);
/*********************************************************************************************
*
* astro.cpp
*
*/
extern void subSolar (time_t t, LatLong &ll);
extern void subLunar (time_t t, LatLong &ll);
extern void sunrs (const time_t &t0, const LatLong &ll, time_t *riset, time_t *sett);
extern float rad2deg(float r);
extern float deg2rad(float d);
#define SPD (3600*24L) // seconds per day
/*********************************************************************************************
*
* brightness.cpp
*
*/
extern void drawBrightness (void);
extern void initBrightness (void);
extern void setupBrightness (void);
extern void followBrightness (void);
extern void changeBrightness (SCoord &s);
extern bool brightnessOn(void);
extern void brightnessOff(void);
extern bool checkBeaconTouch (SCoord &s);
extern bool getDisplayTimes (uint16_t *on, uint16_t *off);
extern bool setDisplayTimes (uint16_t on, uint16_t off);
extern bool brOnOffOk(void);
extern bool brControlOk(void);
extern uint8_t getBrMax(void);
extern uint8_t getBrMin(void);
/*********************************************************************************************
*
* clocks.cpp
*
*/
enum {
DETIME_INFO,
DETIME_ANALOG,
DETIME_CAL,
DETIME_N,
};
extern uint8_t de_time_fmt;
extern void initTime(void);
extern uint32_t nowWO(void);
extern void updateClocks(bool all);
extern bool clockTimeOk(void);
extern void changeTime (time_t t);
extern bool checkClockTouch (SCoord &s);
extern bool checkTZTouch (const SCoord &s, TZInfo &tzi, const LatLong &ll);
extern void enableSyncProvider(void);
extern void drawDESunRiseSetInfo(void);
extern void drawCalendar(bool force);
extern void hideClocks(void);
extern void showClocks(void);
extern void drawDXSunRiseSetInfo(void);
extern uint32_t utcOffset(void);
/*********************************************************************************************
*
* color.cpp
*
*/
// convert 8-bit each (R,G,B) to 5R : 6G : 5G
// would expect this to be in graphics lib but can't find it...
#define RGB565(R,G,B) ((((uint16_t)(R) & 0xF8) << 8) | (((uint16_t)(G) & 0xFC) << 3) | ((uint16_t)(B) >> 3))
// extract 8-bit colors from uint16_t RGB565 color in range 0-255
#define RGB565_R(c) (((c) & 0xF800) >> 8)
#define RGB565_G(c) (((c) & 0x07E0) >> 3)
#define RGB565_B(c) (((c) & 0x001F) << 3)
#define GRAY RGB565(140,140,140)
#define BRGRAY RGB565(200,200,200)
extern void hsvtorgb(uint8_t *r, uint8_t *g, uint8_t *b, uint8_t h, uint8_t s, uint8_t v);
/*********************************************************************************************
*
* dearth-tfh.cpp and nearth-tft.cpp
*
*/
/* with _USE_DESKTOP the application scans every pixel, else we scan every other pixel
*/
#define EARTH_H 330
#define EARTH_XH 1
#if defined(_USE_DESKTOP)
#define EARTH_W 660
#define EARTH_XW 1
#else
#define EARTH_W 330
#define EARTH_XW 2
extern const uint16_t DEARTH[ EARTH_H ][ EARTH_W ] PROGMEM;
extern const uint16_t NEARTH[ EARTH_H ][ EARTH_W ] PROGMEM;
#endif
/*********************************************************************************************
*
* dxcluster.cpp
*
*/
extern void initDXCluster(void);
extern void updateDXCluster(void);
extern void closeDXCluster(void);
extern bool checkDXTouch (const SCoord &s);
extern bool useDXCluster(void);
/*********************************************************************************************
*
* earthmap.cpp
*
*/
#define DX_R 8 // dx marker radius (erases better if even)
#define DX_COLOR RA8875_GREEN
extern SCircle dx_c;
extern LatLong dx_ll;
extern uint16_t map_x0, map_y0;
extern uint16_t map_w, map_h;
extern uint8_t show_km;
extern uint8_t show_lp;
#define ERAD_M 3959.0F // earth radius, miles
#define DE_R 8 // radius of DE marker (erases better if even)
#define DEAP_R 8 // radius of DE antipodal marker (erases better if even)
#define DE_COLOR RGB565(255,125,0) // orange
extern SCircle de_c;
extern LatLong de_ll;
extern float sdelat, cdelat;
extern SCircle deap_c;
extern LatLong deap_ll;
extern LatLong sun_ss_ll;
extern LatLong moon_ss_ll;
#define SUN_R 9 // radius of sun marker
extern float sslng, sslat, csslat, ssslat;
extern SCircle sun_c;
#define MOON_R 9 // radius of moon marker
#define MOON_COLOR RGB565(150,150,150)
extern SCircle moon_c;
extern uint32_t max_wd_dt;
extern void drawMoreEarth (void);
extern void eraseDEMarker (void);
extern void eraseDEAPMarker (void);
extern void drawDEMarker (bool force);
extern void drawDEAPMarker (void);
extern void drawDEInfo (void);
extern void drawDETime (bool center);
extern void drawDXTime (void);
extern void initEarthMap (void);
extern void antipode (LatLong &to, const LatLong &from);
extern void drawMapCoord (const SCoord &s);
extern void drawMapCoord (uint16_t x, uint16_t y);
extern void drawSun (void);
extern void drawMoon (void);
extern void drawDXInfo (void);
extern void ll2s (const LatLong &ll, SCoord &s, uint8_t edge);
extern void ll2s (float lat, float lng, SCoord &s, uint8_t edge);
extern bool s2ll (uint16_t x, uint16_t y, LatLong &ll);
extern bool s2ll (const SCoord &s, LatLong &ll);
extern void solveSphere (float A, float b, float cc, float sc, float *cap, float *Bp);
extern bool checkDistTouch (const SCoord &s);
extern bool checkPathDirTouch (const SCoord &s);
extern void propDEDXPath (bool long_path, float *distp, float *bearp);
extern bool waiting4DXPath(void);
extern void eraseSCircle (const SCircle &c);
extern bool checkDELLTouch (const SCoord &s, LatLong &ll);
extern bool checkDXLLTouch (const SCoord &s, LatLong &ll);
extern void roundLatLong (LatLong &ll);
extern void initScreen(void);
/*********************************************************************************************
*
* BME280.cpp
*
*/
extern bool bme280_connected;
extern void updateBME280 (void);
extern void plotBME280 (void);
extern void initBME280 (void);
extern bool nextBME280Data (time_t *t, float *temp, float *pressure, float *humidity, float *dp, uint8_t *n);
extern void initBME280Retry(void);
/*********************************************************************************************
*
* earthsat.cpp
*
*/
extern void updateSatPath(void);
extern void updateSatPass(void);
extern bool querySatSelection(bool timeout);
extern bool checkSatTouch (const SCoord &s);
extern bool checkSatNameTouch (const SCoord &s);
extern void displaySatInfo(void);
extern void setSatObserver (float lat, float lng);
extern void drawSatPointsOnRow (uint16_t r);
extern void drawSatNameOnRow(uint16_t y);
extern bool dx_info_for_sat;
extern bool setSatFromName (const char *new_name);
extern bool setSatFromTLE (const char *name, const char *t1, const char *t2);
extern bool initSatSelection(void);
extern bool getSatAzElNow (char *name, float *azp, float *elp, float *razp, float *sazp,
float *rdtp, float *sdtp);
extern bool isNewPass(void);
extern bool isSatMoon(void);
#define SAT_NOAZ (-999) // error flag
#define SAT_MIN_EL 1.0F // rise elevation
#define TLE_LINEL 70 // including EOS
/*********************************************************************************************
*
* gimbal.cpp
*
*/
extern void initGimbalGUI(void);
extern bool haveGimbal(void);
extern void updateGimbal (void);
extern bool checkGimbalTouch (const SCoord &s);
extern void stopGimbalNow(void);
extern void closeGimbal(void);
extern bool getGimbalWrapAz (float *azp);
/*********************************************************************************************
*
* gpsd.cpp
*
*/
extern void getGPSDDELatLong (void);
extern time_t getGPSDUTC(void);
/*********************************************************************************************
*
* setup.cpp
*
*/
extern void clockSetup(void);
extern char *getWiFiSSID(void);
extern char *getWiFiPW(void);
extern char *getCallsign(void);
extern char *getDXClusterHost(void);
extern int getDXClusterPort(void);
extern bool useMetricUnits(void);
extern bool useGeoIP(void);
extern bool rotateScreen(void);
extern float getBMETempCorr(void);
extern float getBMEPresCorr(void);
extern bool getGPSDHost (char *host);
extern uint32_t getKX3Baud(void);
extern void drawStringInBox (const char str[], const SBox &b, bool inverted, uint16_t color);
/*********************************************************************************************
*
* magdecl.cpp
*
*/
extern int magdecl (float l, float L, float e, float y, float *mdp);
/*********************************************************************************************
*
* mymath.cpp
*
*/
extern float myfmodf (float x, float y);
extern float myatof (const char *s);
// float versions
#define M_PIF 3.14159265F
#define M_PI_2F (M_PIF/2)
/*********************************************************************************************
*
* ncdxf.cpp
*
*/
extern void updateBeacons (bool erase_too, bool immediate, bool force);
extern void updateBeaconScreenLocations(void);
extern bool overAnyBeacon (const SCoord &s);
extern void drawBeaconBox();
typedef uint8_t BeaconID;
/*********************************************************************************************
*
* nvram.cpp
*
*/
/* names of each entry
* N.B. the entries here must match those in nv_sizes[]
*/
typedef enum {
NV_TOUCH_CAL_A,
NV_TOUCH_CAL_B,
NV_TOUCH_CAL_C,
NV_TOUCH_CAL_D,
NV_TOUCH_CAL_E,
NV_TOUCH_CAL_F,
NV_TOUCH_CAL_DIV,
NV_DE_DST, // not used
NV_DE_TIMEFMT,
NV_DE_LAT,
NV_DE_LNG,
NV_DE_GRID,
NV_DX_DST, // not used
NV_DX_LAT,
NV_DX_LNG,
NV_DX_GRID,
NV_CALL_FG_COLOR,
NV_CALL_BG_COLOR,
NV_CALL_BG_RAINBOW,
NV_DIST_KM,
NV_UTC_OFFSET,
NV_PLOT_1,
NV_PLOT_2,
NV_BRB_MODE,
NV_PLOT_3,
NV_RSS_ON,
NV_BPWM_DIM,
NV_PHOT_DIM,
NV_BPWM_BRIGHT,
NV_PHOT_BRIGHT,
NV_LP,
NV_METRIC_ON,
NV_LKSCRN_ON,
NV_AZIMUTHAL_ON,
NV_ROTATE_SCRN,
NV_WIFI_SSID,
NV_WIFI_PASSWD,
NV_CALLSIGN,
NV_SATNAME,
NV_DE_SRSS,
NV_DX_SRSS,
NV_LLGRID,
NV_DPYON,
NV_DPYOFF,
NV_DXHOST,
NV_DXPORT,
NV_SWHUE,
NV_TEMPCORR,
NV_GPSDHOST,
NV_KX3BAUD,
NV_BCPOWER,
NV_CD_PERIOD,
NV_PRESCORR,
NV_BR_IDLE,
NV_BR_MIN,
NV_BR_MAX,
NV_DE_TZ,
NV_DX_TZ,
NV_N
} NV_Name;
// string valued lengths including trailing EOS
#define NV_WIFI_SSID_LEN 32
#define NV_WIFI_PW_LEN 32
#define NV_CALLSIGN_LEN 12
#define NV_SATNAME_LEN 9
#define NV_DXHOST_LEN 26
#define NV_GPSDHOST_LEN 18
// accessor functions
extern void NVWriteFloat (NV_Name e, float f);
extern void NVWriteUInt32 (NV_Name e, uint32_t u);
extern void NVWriteInt32 (NV_Name e, int32_t u);
extern void NVWriteUInt16 (NV_Name e, uint16_t u);
extern void NVWriteUInt8 (NV_Name e, uint8_t u);
extern void NVWriteString (NV_Name e, const char *str);
extern bool NVReadFloat (NV_Name e, float *fp);
extern bool NVReadUInt32 (NV_Name e, uint32_t *up);
extern bool NVReadInt32 (NV_Name e, int32_t *up);
extern bool NVReadUInt16 (NV_Name e, uint16_t *up);
extern bool NVReadUInt8 (NV_Name e, uint8_t *up);
extern bool NVReadString (NV_Name e, char *buf);
/*********************************************************************************************
*
* maidenhead.cpp
*
*/
extern void ll2maidenhead (char maid[2][5], const LatLong &ll);
extern void maidenhead2ll (LatLong &ll, const char maid[5]);
extern void drawMaidenhead(NV_Name nv, SBox &b, uint16_t color);
extern void setMaidenhead(NV_Name nv, LatLong &ll);
extern void toggleMaidenhead(NV_Name nv, LatLong &ll);
/*********************************************************************************************
*
* plot.cpp
*
*/
enum {
PLOT1_SSN,
PLOT1_FLUX,
PLOT1_BC,
PLOT1_N,
};
enum {
PLOT2_KP,
PLOT2_XRAY,
PLOT2_BC,
PLOT2_DX,
PLOT2_N,
};
enum {
PLOT3_TEMP, PLOT3_PRESSURE, PLOT3_HUMIDITY, PLOT3_DEWPOINT,
PLOT3_SDO_1, PLOT3_SDO_2, PLOT3_SDO_3,
PLOT3_GIMBAL,
PLOT3_KP,
PLOT3_N
};
typedef struct {
char city[32];
float temperature_c;
float humidity_percent;
float wind_speed_mps;
char wind_dir_name[4];
char clouds[32];
char conditions[32];
char attribution[32];
} WXInfo;
bool plotBandConditions (const SBox &box, char response[], char config[]);
extern bool plotXY (const SBox &box, float x[], float y[], int nxy, const char *xlabel,
const char *ylabel, uint16_t color, float center_value);
extern bool plotXYstr (const SBox &box, float x[], float y[], int nxy, const char *xlabel,
const char *ylabel, uint16_t color, char *label_str);
extern void plotKp (SBox &b, uint8_t kp[], uint8_t nhkp, uint8_t npkp, uint16_t color);
extern void plotWX (const SBox &b, uint16_t color, const WXInfo &wi);
extern void plotMessage (const SBox &b, uint16_t color, const char *message);
/*********************************************************************************************
*
* prefixes.cpp
*
*/
extern bool nearestPrefix (const LatLong &ll, char prefix[MAX_PREF_LEN+1]);
/*********************************************************************************************
*
* radio.cpp
*
*/
void setRadioSpot (float kHz);
/*********************************************************************************************
*
* santa.cpp
*
*/
extern void drawSanta(void);
extern SBox santa_b;
/*********************************************************************************************
*
* selectFont.cpp
*
*/
extern const GFXfont Germano_Regular16pt7b PROGMEM;
extern const GFXfont Germano_Bold16pt7b PROGMEM;
extern const GFXfont Germano_Bold30pt7b PROGMEM;
typedef enum {
BOLD_FONT,
LIGHT_FONT
} FontWeight;
typedef enum {
FAST_FONT,
SMALL_FONT,
LARGE_FONT
} FontSize;
extern void selectFontStyle (FontWeight w, FontSize s);
/*********************************************************************************************
*
* sphere.cpp
*
*/
extern void solveSphere (float A, float b, float cc, float sc, float *cap, float *Bp);
/*********************************************************************************************
*
* touch.cpp
*
*/
// touch screen actions
typedef enum {
TT_NONE, // no touch event
TT_TAP, // brief touch event
TT_HOLD, // at least TOUCH_HOLDT
} TouchType;
extern void calibrateTouch(bool force);
extern void drainTouch(void);
extern TouchType readCalTouch (SCoord &s);
extern TouchType wifi_tt;
extern SCoord wifi_tt_s;
/*********************************************************************************************
*
* stopwatch.cpp
*
*/
extern SBox stopwatch_b;
extern uint32_t countdown_period;
extern void checkStopwatchTouch(TouchType tt);
extern bool runStopwatch(void);
extern void drawMainPageStopwatch (bool force);
extern void startCountdown(uint32_t ms);
extern uint32_t getCountdownLeft(void);
/*********************************************************************************************
*
* tz.cpp
*
*/
extern int32_t getTZ (const LatLong &ll);
/*********************************************************************************************
*
* webserver.cpp
*
*/
extern void initWebServer(void);
extern void checkWebServer(void);
/*********************************************************************************************
*
* wifi.cpp
*
*/
extern void initWiFi (bool verbose);
extern void initWiFiRetry(void);
extern void newBC(void);
extern void updateWiFi(void);
extern void revertPlot1 (uint32_t dt);
extern bool checkPlot1Touch (const SCoord &s);
extern bool checkPlot2Touch (const SCoord &s);
extern bool checkPlot3Touch (const SCoord &s);
extern bool getChar (WiFiClient &client, char *cp);
extern time_t getNTPUTC(void);
extern bool updateRSS (void);
extern void updateRSSNow(void);
extern bool getTCPLine (WiFiClient &client, char line[], uint16_t line_len, uint16_t *ll);
extern void sendUserAgent (WiFiClient &client);
extern bool wifiOk(void);
extern void httpGET (WiFiClient &client, const char *server, const char *page);
extern bool httpSkipHeader (WiFiClient &client);
extern void FWIFIPR (WiFiClient &client, const __FlashStringHelper *str);
extern void FWIFIPRLN (WiFiClient &client, const __FlashStringHelper *str);
// standard ports
#define HTTPPORT 80
/*********************************************************************************************
*
* wx.cpp
*
*/
#define N_WXINFO_FIELDS 8
extern void showDXWX(void);
extern void showDEWX(void);
#endif // _HAMCLOCK_H