mirror of
https://github.com/schinken/esp8266-geigercounter.git
synced 2024-11-23 09:00:21 +01:00
Code format
This commit is contained in:
parent
4823f0a36b
commit
e06c587b19
1 changed files with 57 additions and 55 deletions
|
@ -18,6 +18,8 @@ float lastuSv = 0, currentuSv = 0;
|
|||
|
||||
void setup() {
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
Serial.begin(115200);
|
||||
geigerCounterSerial.begin(BAUD_GEIGERCOUNTER);
|
||||
|
||||
|
@ -46,14 +48,14 @@ void updateRadiationValues() {
|
|||
|
||||
char tmp[8];
|
||||
|
||||
if(currentCPM != lastCPM) {
|
||||
if (currentCPM != lastCPM) {
|
||||
String(currentCPM).toCharArray(tmp, 8);
|
||||
Serial.print("Sending CPM");
|
||||
Serial.println(tmp);
|
||||
mqttClient.publish(MQTT_TOPIC_CPM, tmp, true);
|
||||
}
|
||||
|
||||
if(currentuSv != lastuSv) {
|
||||
if (currentuSv != lastuSv) {
|
||||
String(currentuSv).toCharArray(tmp, 8);
|
||||
Serial.print("Sending uSv");
|
||||
Serial.println(tmp);
|
||||
|
@ -77,7 +79,7 @@ void connectMqtt() {
|
|||
newConnection = true;
|
||||
}
|
||||
|
||||
if(newConnection) {
|
||||
if (newConnection) {
|
||||
mqttClient.publish(MQTT_TOPIC_LAST_WILL, "connected", true);
|
||||
}
|
||||
|
||||
|
@ -95,7 +97,7 @@ void parseReceivedLine(char* input) {
|
|||
|
||||
while (token != NULL) {
|
||||
|
||||
switch(segment) {
|
||||
switch (segment) {
|
||||
|
||||
// This is just for validation
|
||||
case IDX_CPS_KEY: if (strcmp(token, "CPS") != 0) return; break;
|
||||
|
@ -113,7 +115,7 @@ void parseReceivedLine(char* input) {
|
|||
break;
|
||||
}
|
||||
|
||||
if(segment > 7) {
|
||||
if (segment > 7) {
|
||||
// Invalid! There should be no more than 7 segments
|
||||
return;
|
||||
}
|
||||
|
@ -145,7 +147,7 @@ void loop() {
|
|||
}
|
||||
|
||||
// Just in case the buffer gets to big, start from scratch
|
||||
if(serialInput.length() > RECV_LINE_SIZE + 10) {
|
||||
if (serialInput.length() > RECV_LINE_SIZE + 10) {
|
||||
serialInput = "";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue