diff --git a/ExtSens/src/main.cpp b/ExtSens/src/main.cpp index e84a47e..63fc2b5 100644 --- a/ExtSens/src/main.cpp +++ b/ExtSens/src/main.cpp @@ -51,6 +51,7 @@ void setup() { sendData(msgTemp, temp_out, 1); sendData(msgHum, hum_out, 1); unsigned long battMV = hwCPUVoltage(); + v_out = battMV / 1000.0; sendData(msgVolts, battMV / 1000.0, 2); cRun = 0; sendData(msgMillis, cRun); @@ -75,7 +76,7 @@ void loop() { // send(msgHum.set(hum, 1)); } unsigned long battMV = hwCPUVoltage(); - v_out += (battMV / 1000.0 - v_out) * 0.1; + v_out += ((battMV / 1000.0) - v_out) * 0.1; //sensorValue = analogRead(BATTERY_SENSE_PIN); //v = sensorValue * 0.004659498; //batteryPcnt = ((v-3.0) * 100) / 1.2; @@ -107,14 +108,14 @@ void sendData(MyMessage msg, bool status) uint8_t count = 0; while(send_data == false){ count++; - Serial.print(millis()); - Serial.println(" send before"); + //Serial.print(millis()); + //Serial.println(" send before"); send_data = send(msg.set(status)); - Serial.print(millis()); - Serial.println(" send after"); + //Serial.print(millis()); + //Serial.println(" send after"); wait(1000, C_SET, msg.type); - Serial.print(millis()); - Serial.println(" wait comlete"); + //Serial.print(millis()); + //Serial.println(" wait comlete"); if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки count = 0; // Обнуляем счётчик send_data = 1; // Выходим из цикла @@ -127,11 +128,11 @@ void sendData(MyMessage msg, float status, uint8_t decm) uint8_t count = 0; while(send_data == false){ count++; - Serial.print(millis()); - Serial.println(" send before"); + //Serial.print(millis()); + //Serial.println(" send before"); send_data = send(msg.set(status, decm)); - Serial.print(millis()); - Serial.println(" send after"); + //Serial.print(millis()); + //Serial.println(" send after"); if(!send_data){ wait(50, C_SET, msg.type); Serial.print(millis()); @@ -167,8 +168,8 @@ void sendData(MyMessage msg, uint32_t status) send_data = send(msg.set(status)); if(!send_data){ wait(50, C_SET, msg.type); - Serial.print(millis()); - Serial.println(" wait comlete"); + //Serial.print(millis()); + //Serial.println(" wait comlete"); } if ((count == 3 )&&(send_data == 0)){ // Если сделано 3 попытки и нет подтверждения отправки count = 0; // Обнуляем счётчик