Code format

This commit is contained in:
schinken 2016-02-20 22:21:44 +01:00
parent 4823f0a36b
commit e06c587b19
1 changed files with 57 additions and 55 deletions

View File

@ -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 = "";
}