Skip to content

Commit b43d29b

Browse files
committed
Update geiger.ino
1 parent 48f7451 commit b43d29b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

geiger/geiger.ino

+10-9
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
3333
*/
3434

35-
#include <TFT_eSPI.h> // Hardware-specific library for TFT
35+
#include <TFT_eSPI.h> // Hardware-specific library for TFT display
3636
#include <SPI.h>
37-
#include "radiation64.h" // icon file with yellow radiation symbol
37+
#include "radiation64.h" // icon file with yellow radiation symbol
3838

3939
// 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
4444

4545
// Program paramters
4646
#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() {
151151
displaymode = !displaymode;
152152
tft.fillScreen(TFT_WHITE);
153153
tft.setSwapBytes(true);
154-
tft.setTextColor(TFT_BLACK); // Text colour
154+
tft.setTextColor(TFT_BLACK);
155155
if (displaymode) {
156156
// 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
158158
tft.drawString("V", 90, TEXTBARY, 2);
159159
tft.drawString("mR/hr", 140, TEXTBARY, 2); // value indicator lower right corner
160160
Serial.println("Set history bar mode");
@@ -219,6 +219,7 @@ int mrem2perc(float mrem, int maxperc) {
219219
} else {
220220
int v = (float(maxperc)/3)*(log10(mrem)+1);
221221
if (v>maxperc) v=maxperc;
222+
if (v<0) v=0;
222223
return v;
223224
}
224225
}
@@ -271,7 +272,7 @@ void analogMeterLog() {
271272
}
272273
}
273274
// Short scale tick length
274-
if ((i+45) % 30 != 0) tl = 8;
275+
if ((i+45) % 30 != 0) tl = 7;
275276

276277
// Recalculate coords incase tick lenght changed
277278
x0 = sx * (M_SIZE*100 + tl) + M_SIZE*120;

0 commit comments

Comments
 (0)