Browse Source

subtract own radiation

lightsleep
Hendrik Langer 7 years ago
parent
commit
7868ef96b9
  1. 4
      src/main.cpp

4
src/main.cpp

@ -58,6 +58,7 @@ static constexpr uint8_t SDS_RX = D2;
static constexpr uint8_t GEIGER_PIN = D6;
static constexpr float CONV_FACTOR = 0.008120;
static constexpr float OWN_BACKGROUND_CPS = 0.2;
static constexpr unsigned long logging_period_ms = 60000;
ADC_MODE(ADC_VCC);
@ -114,9 +115,10 @@ void ICACHE_FLASH_ATTR sendValues() {
float radiationValue = -1;
if (millis() - geiger_previousMillis > logging_period_ms) {
cpm = geiger_counts * 60000 / (millis() - geiger_previousMillis);
unsigned long constexpr own_cpm = OWN_BACKGROUND_CPS * 60;
geiger_previousMillis = millis();
geiger_counts = 0;
radiationValue = cpm * CONV_FACTOR;
radiationValue = (cpm - own_cpm) * CONV_FACTOR;
// Serial.println(cpm);
} else {
// Serial.println("Geiger Counter: no new value");

Loading…
Cancel
Save