Skip to content

Commit

Permalink
Add some variance to test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
steadramon committed Dec 21, 2023
1 parent 7b2e86a commit 61c4377
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions ESPGeiger/src/Counter/Counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
#define COUNTER_H
#include <Arduino.h>
#include "../Status.h"
#include "../NTP/NTP.h"
#include <Ticker.h>

#ifdef GEIGER_NEOPIXEL
#include "../NeoPixel/NeoPixel.h"
extern NeoPixel neopixel;
#endif

#ifndef GEIGER_RATIO
#define GEIGER_RATIO 151.0
#endif
Expand Down Expand Up @@ -353,6 +359,50 @@ static void handleSecondTick() {
if (secidx % 15 == 0) {
status.geigerTicks15.add(status.geigerTicks5.get());
}
float our_cpm = status.geigerTicks.get()*60;
if (status.cpm_warning < our_cpm) {
status.high_cpm_warning = true;
} else {
status.high_cpm_warning = false;
}
if (status.cpm_alert < our_cpm ) {
status.high_cpm_alarm = true;
} else {
status.high_cpm_alarm = false;
}

#ifdef GEIGERTESTMODE
secidx = (millis() / 1000) % 240;
if (secidx == 0) {
#if GEIGER_TYPE == GEIGER_TYPE_TEST
timer1_write(8000000);
#elif GEIGER_TYPE == GEIGER_TYPE_TESTPULSE
timer1_write(300);
#endif
}
if (secidx == 60) {
#if GEIGER_TYPE == GEIGER_TYPE_TEST
timer1_write(5000000);
#elif GEIGER_TYPE == GEIGER_TYPE_TESTPULSE
timer1_write(300);
#endif
}
if (secidx == 120) {
#if GEIGER_TYPE == GEIGER_TYPE_TEST
timer1_write(1000000);
#elif GEIGER_TYPE == GEIGER_TYPE_TESTPULSE
timer1_write(300);
#endif
}
if (secidx == 180) {
#if GEIGER_TYPE == GEIGER_TYPE_TEST
timer1_write(1000);
#elif GEIGER_TYPE == GEIGER_TYPE_TESTPULSE
timer1_write(300);
#endif
}

#endif
};
#endif

Expand All @@ -375,6 +425,7 @@ class Counter {
void set_tx_pin(int pin);
int get_rx_pin();
int get_tx_pin();
void blip_led();
void begin();
const char* geiger_model() { return GEIGER_MODEL; };
private:
Expand Down

0 comments on commit 61c4377

Please sign in to comment.