Code format

This commit is contained in:
schinken 2016-02-20 22:21:44 +01:00
parent 4823f0a36b
commit e06c587b19

View file

@ -18,6 +18,8 @@ float lastuSv = 0, currentuSv = 0;
void setup() { void setup() {
WiFi.mode(WIFI_STA);
Serial.begin(115200); Serial.begin(115200);
geigerCounterSerial.begin(BAUD_GEIGERCOUNTER); geigerCounterSerial.begin(BAUD_GEIGERCOUNTER);
@ -46,14 +48,14 @@ void updateRadiationValues() {
char tmp[8]; char tmp[8];
if(currentCPM != lastCPM) { if (currentCPM != lastCPM) {
String(currentCPM).toCharArray(tmp, 8); String(currentCPM).toCharArray(tmp, 8);
Serial.print("Sending CPM"); Serial.print("Sending CPM");
Serial.println(tmp); Serial.println(tmp);
mqttClient.publish(MQTT_TOPIC_CPM, tmp, true); mqttClient.publish(MQTT_TOPIC_CPM, tmp, true);
} }
if(currentuSv != lastuSv) { if (currentuSv != lastuSv) {
String(currentuSv).toCharArray(tmp, 8); String(currentuSv).toCharArray(tmp, 8);
Serial.print("Sending uSv"); Serial.print("Sending uSv");
Serial.println(tmp); Serial.println(tmp);
@ -77,7 +79,7 @@ void connectMqtt() {
newConnection = true; newConnection = true;
} }
if(newConnection) { if (newConnection) {
mqttClient.publish(MQTT_TOPIC_LAST_WILL, "connected", true); mqttClient.publish(MQTT_TOPIC_LAST_WILL, "connected", true);
} }
@ -95,7 +97,7 @@ void parseReceivedLine(char* input) {
while (token != NULL) { while (token != NULL) {
switch(segment) { switch (segment) {
// This is just for validation // This is just for validation
case IDX_CPS_KEY: if (strcmp(token, "CPS") != 0) return; break; case IDX_CPS_KEY: if (strcmp(token, "CPS") != 0) return; break;
@ -113,7 +115,7 @@ void parseReceivedLine(char* input) {
break; break;
} }
if(segment > 7) { if (segment > 7) {
// Invalid! There should be no more than 7 segments // Invalid! There should be no more than 7 segments
return; return;
} }
@ -145,7 +147,7 @@ void loop() {
} }
// Just in case the buffer gets to big, start from scratch // 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 = ""; serialInput = "";
} }