diff --git a/lib/obp60task/OBPSensorTask.cpp b/lib/obp60task/OBPSensorTask.cpp index ce19665..70d19d9 100644 --- a/lib/obp60task/OBPSensorTask.cpp +++ b/lib/obp60task/OBPSensorTask.cpp @@ -83,6 +83,7 @@ void sensorTask(void *param){ RTC_DS1388 ds1388; // RTC DS1388 OneWire oneWire(OBP_1WIRE); // 1Wire bus DallasTemperature ds18b20(&oneWire);// Sensors for DS18B20 + DeviceAddress tempDeviceAddress;// Table for DS18B20 device addresses // Init sensor stuff bool oneWire_ready = false; // 1Wire initialized and ready to use @@ -138,13 +139,13 @@ void sensorTask(void *param){ api->getLogger()->logDebug(GwLog::ERROR,"Modul DS18B20 not found, check wiring"); } else{ - api->getLogger()->logDebug(GwLog::LOG,"Modul DS18B20 found at:"); + api->getLogger()->logDebug(GwLog::LOG,"1Wire modul found at:"); for(int i=0;igetLogger()->logDebug(GwLog::LOG,"Device-%01d: %10d", i, tempDeviceAddress); + api->getLogger()->logDebug(GwLog::LOG,"DS18B20-%01d: %12d", i, tempDeviceAddress[i]); } else { - api->getLogger()->logDebug(GwLog::LOG,"Device-%01d: Is ghost with errors", i); + api->getLogger()->logDebug(GwLog::LOG,"DS18B20-%01d: Sensor with errors, check wiring!", i); } } oneWire_ready = true; @@ -209,15 +210,6 @@ void sensorTask(void *param){ GPS_ready = true; } } - - // Settings for temperature sensors - String tempSensor = api->getConfig()->getConfigItem(api->getConfig()->useTempSensor,true)->asString(); - if(String(tempSensor) == "DS18B20"){ - api->getLogger()->logDebug(GwLog::LOG,"1Wire Mode is On"); - } - else{ - api->getLogger()->logDebug(GwLog::LOG,"1Wire Mode is Off"); - } // Settings for environment sensors on I2C bus String envSensors=api->getConfig()->getConfigItem(api->getConfig()->useEnvSensor,true)->asString(); @@ -381,6 +373,7 @@ void sensorTask(void *param){ long starttime10 = millis(); // Generator power sensor update all 1s long starttime11 = millis(); // Copy GPS data to RTC all 5min long starttime12 = millis(); // Get RTC data all 500ms + long starttime13 = millis(); // Get 1Wire sensor data all 1s tN2kMsg N2kMsg; shared->setSensorData(sensors); //set initially read values @@ -410,6 +403,7 @@ void sensorTask(void *param){ } } + // If RTC DS1388 ready, then copy GPS data to RTC all 5min if(millis() > starttime11 + 5*60*1000){ starttime11 = millis(); @@ -427,6 +421,25 @@ void sensorTask(void *param){ } } + // Send 1Wire data for all temperature sensors all 1s + if(millis() > starttime13 + 1000 && String(oneWireOn) == "DS18B20" && oneWire_ready == true){ + starttime13 = millis(); + float tempC; + ds18b20.requestTemperatures(); // Collect all temperature values + for(int i=0;isendN2kMessage(N2kMsg); + api->getLogger()->logDebug(GwLog::LOG,"DS18B20-%1d Temp: %.1f",i,tempC); + } + } + } + // If GPS not ready or installed then send RTC time on bus all 500ms if(millis() > starttime12 + 500){ starttime12 = millis(); diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 38471ff..13d5ad6 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -282,7 +282,7 @@ "label": "GPS Sensor", "type": "list", "default": "ATGM336H", - "description": "Use internal GPS module type [off|NEO-6M|NEO-M8N]", + "description": "Use internal GPS module type [off|NEO-6M|NEO-M8N|ATGM336H]", "list": [ "off", "NEO-6M", @@ -299,7 +299,7 @@ "label": "Env. Sensor", "type": "list", "default": "BMP280", - "description": "Use internal or external environment sensor via I2C bus [off|BME280|BMP280|SHT21]", + "description": "Use internal or external environment sensor via I2C bus [off|BME280|BMP280|BMP180|BMP085|HTU21|SHT21]", "list": [ "off", "BME280", @@ -518,7 +518,7 @@ "label": "Temp. Sensor", "type": "boolean", "default": "off", - "description": "Use external 1Wire device [off|DS18B20]", + "description": "Use max. 8 external 1Wire devices [off|DS18B20]", "list": [ "off", "DS18B20"