|
32 | 32 |
|
33 | 33 | */
|
34 | 34 |
|
35 |
| -#include <TFT_eSPI.h> // Hardware-specific library for TFT |
| 35 | +#include <TFT_eSPI.h> // Hardware-specific library for TFT display |
36 | 36 | #include <SPI.h>
|
37 |
| -#include "radiation64.h" // icon file with yellow radiation symbol |
| 37 | +#include "radiation64.h" // icon file with yellow radiation symbol |
38 | 38 |
|
39 | 39 | // Define Hardware PIN numbers
|
40 |
| -#define PINTIC 27 // GPIO27 is tic from geiger counter |
41 |
| -#define PINTOUCH 12 // GPIO12 is touch interface display mode switch |
42 |
| -#define PINADC 26 // GPIO26 to measure battery voltage |
43 |
| -#define TICFACTOR 0.1 // factor between number of tics/second --> mR/hr |
| 40 | +#define PINTIC 27 // GPIO27 is tic from geiger counter |
| 41 | +#define PINTOUCH 12 // GPIO12 is touch interface display mode switch |
| 42 | +#define PINADC 26 // GPIO26 to measure battery voltage |
| 43 | +#define TICFACTOR 0.05 // factor between number of tics/second --> mR/hr |
44 | 44 |
|
45 | 45 | // Program paramters
|
46 | 46 | #define M_SIZE 1 // Define size of analog meter size (1 = full screen, 0.667 fills 2/3 of screen)
|
@@ -151,10 +151,10 @@ void loop() {
|
151 | 151 | displaymode = !displaymode;
|
152 | 152 | tft.fillScreen(TFT_WHITE);
|
153 | 153 | tft.setSwapBytes(true);
|
154 |
| - tft.setTextColor(TFT_BLACK); // Text colour |
| 154 | + tft.setTextColor(TFT_BLACK); |
155 | 155 | if (displaymode) {
|
156 | 156 | // now switch to history bar graph mode
|
157 |
| - tft.drawString("Batt", 10, TEXTBARY, 2); // batt indicator lower left corner |
| 157 | + tft.drawString("Batt", 10, TEXTBARY, 2); // batt indicator lower left corner |
158 | 158 | tft.drawString("V", 90, TEXTBARY, 2);
|
159 | 159 | tft.drawString("mR/hr", 140, TEXTBARY, 2); // value indicator lower right corner
|
160 | 160 | Serial.println("Set history bar mode");
|
@@ -219,6 +219,7 @@ int mrem2perc(float mrem, int maxperc) {
|
219 | 219 | } else {
|
220 | 220 | int v = (float(maxperc)/3)*(log10(mrem)+1);
|
221 | 221 | if (v>maxperc) v=maxperc;
|
| 222 | + if (v<0) v=0; |
222 | 223 | return v;
|
223 | 224 | }
|
224 | 225 | }
|
@@ -271,7 +272,7 @@ void analogMeterLog() {
|
271 | 272 | }
|
272 | 273 | }
|
273 | 274 | // Short scale tick length
|
274 |
| - if ((i+45) % 30 != 0) tl = 8; |
| 275 | + if ((i+45) % 30 != 0) tl = 7; |
275 | 276 |
|
276 | 277 | // Recalculate coords incase tick lenght changed
|
277 | 278 | x0 = sx * (M_SIZE*100 + tl) + M_SIZE*120;
|
|
0 commit comments