Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
steadramon committed Dec 21, 2023
1 parent a123a78 commit b8e71f5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
40 changes: 32 additions & 8 deletions ESPGeiger/ESPGeiger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
#ifdef ESPGEIGER_HW
#include "src/ESPGHW/ESPGHW.h"
#endif
#ifdef GEIGER_PUSHBUTTON
#include "src/PushButton/PushButton.h"
#endif

#include "src/ConfigManager/ConfigManager.h"
#include "src/Status.h"
#include "src/Counter/Counter.h"
Expand All @@ -35,6 +33,9 @@
#include "src/Thingspeak/Thingspeak.h"
#include "src/GMC/GMC.h"
#include "src/Logger/Logger.h"
#include "src/SDCard/SDCard.h"
#include "src/NeoPixel/NeoPixel.h"
#include "src/PushButton/PushButton.h"
#include "src/NTP/NTP.h"
#include "src/ArduinoOTA/ArduinoOTA.h"
#include <FS.h>
Expand All @@ -47,7 +48,12 @@
#ifdef SERIALOUT
#include "src/SerialOut/SerialOut.h"
#endif

#ifdef GEIGER_SDCARD
SDCard sdcard = SDCard::getInstance();
#endif
#ifdef GEIGER_NEOPIXEL
NeoPixel neopixel = NeoPixel::getInstance();
#endif
#ifdef GEIGER_PUSHBUTTON
PushButton pushbutton = PushButton();
#endif
Expand Down Expand Up @@ -121,7 +127,16 @@ void msTickerCB()
status.blip_led.Update();
#endif
}

int getQuality() {
if (WiFi.status() != WL_CONNECTED)
return -1;
int dBm = WiFi.RSSI();
if (dBm <= -100)
return 0;
if (dBm >= -50)
return 100;
return 2 * (dBm + 100);
}
void sTickerCB()
{
#ifdef SERIALOUT
Expand All @@ -146,14 +161,19 @@ void sTickerCB()
#ifdef THINGSPEAKOUT
thingspeak.loop();
#endif
#ifdef GEIGER_SDCARD
sdcard.loop();
#endif
}

void setup()
{
Serial.begin(115200);
Serial.println();
delay(100);

#ifdef GEIGER_NEOPIXEL
neopixel.setup();
#endif
#ifdef ESP8266
if(!LittleFS.begin()){
#elif defined(ESP32)
Expand All @@ -177,7 +197,7 @@ void setup()
if (!cManager.getWiFiIsSaved()) {
display.setupWifi(hostName);
}
#endif
#endif
cManager.autoConnect();
delay(100);
cManager.startWebPortal();
Expand Down Expand Up @@ -207,14 +227,18 @@ void loop()
#ifdef MQTTOUT
mqtt.loop();
#endif

#ifndef DISABLE_SERIALRX
handleSerial();
#endif
gcounter.loop();
#ifdef GEIGER_PUSHBUTTON
pushbutton.loop();
#endif
#ifdef SSD1306_DISPLAY
display.loop();
#endif
#ifdef GEIGER_NEOPIXEL
neopixel.loop();
#endif
ArduinoOTA.handle();
}
3 changes: 3 additions & 0 deletions ESPGeiger/src/Status.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ struct Status {
const char* version = RELEASE_VERSION;
const char* git_version = GIT_VERSION;
bool high_cpm_alarm = false;
bool high_cpm_warning = false;
bool ntp_synced = false;
int cpm_warning = 50;
int cpm_alert = 100;
Smoothed <float> geigerTicks;
Smoothed <float> geigerTicks5;
Smoothed <float> geigerTicks15;
Expand Down

0 comments on commit b8e71f5

Please sign in to comment.