mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-04 06:10:37 +08:00
Isolate sensor unit for easier post treatment
This commit is contained in:
parent
9be683efc3
commit
a035516a20
@ -78,8 +78,9 @@ const char * AnalogSensorDevice::GetModelString(uint8_t i)
|
|||||||
const char * AnalogSensorDevice::GetData()
|
const char * AnalogSensorDevice::GetData()
|
||||||
{
|
{
|
||||||
static String s;
|
static String s;
|
||||||
s = String(SENSOR_CONVERTER(analogRead(ESP3D_SENSOR_PIN)));
|
s = String(SENSOR_CONVERTER(analogRead(ESP3D_SENSOR_PIN))) + "[";
|
||||||
s += SENSOR__UNIT;
|
s += SENSOR__UNIT;
|
||||||
|
s +="]";
|
||||||
return s.c_str();
|
return s.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,11 +167,12 @@ const char * BMX280SensorDevice::GetData()
|
|||||||
temperature = toFahrenheit(temperature);
|
temperature = toFahrenheit(temperature);
|
||||||
}
|
}
|
||||||
s= String(temperature,1);
|
s= String(temperature,1);
|
||||||
|
s+= "[";
|
||||||
s+= SENSOR__UNIT;
|
s+= SENSOR__UNIT;
|
||||||
s+= " " +String(pressure,1);
|
s+= "] " +String(pressure,1);
|
||||||
s+= "Pa";
|
s+= "[Pa]";
|
||||||
if (bmx280_device->isBME280()) {
|
if (bmx280_device->isBME280()) {
|
||||||
s+=" " + String(humidity,1) + "%";
|
s+=" " + String(humidity,1) + "[%]";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s="DISCONNECTED";
|
s="DISCONNECTED";
|
||||||
|
@ -134,8 +134,9 @@ const char * DHTSensorDevice::GetData()
|
|||||||
}
|
}
|
||||||
if ( String(humidity,1)!="nan") {
|
if ( String(humidity,1)!="nan") {
|
||||||
s= String(temperature,1);
|
s= String(temperature,1);
|
||||||
s+= SENSOR__UNIT;
|
s+= "[";
|
||||||
s+=" " + String(humidity,1) + "%";
|
s+= SENSOR__UNIT+
|
||||||
|
s+="] " + String(humidity,1) + "[%]";
|
||||||
} else {
|
} else {
|
||||||
s="DISCONNECTED";
|
s="DISCONNECTED";
|
||||||
log_esp3d("No valid data");
|
log_esp3d("No valid data");
|
||||||
|
@ -45,7 +45,10 @@ public:
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual uint8_t GetModel(uint8_t i=0){ return 0;}
|
virtual uint8_t GetModel(uint8_t i=0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
virtual const char *GetModelString(uint8_t i=0)
|
virtual const char *GetModelString(uint8_t i=0)
|
||||||
{
|
{
|
||||||
return "None";
|
return "None";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user