@@ -228,7 +228,9 @@ float C1WireByOWFS::GetHumidity(const _t1WireDevice& device) const
228
228
229
229
float C1WireByOWFS::GetPressure (const _t1WireDevice& device) const
230
230
{
231
- std::string readValue=readRawData (std::string (device.filename +" /pressure" ));
231
+ std::string realFilename = device.filename + nameHelper (device.filename , device.family ); // for family 26 (DS2438) + pressure + HobbyBoards
232
+
233
+ std::string readValue=readRawData (std::string (realFilename+" /pressure" ));
232
234
if (readValue.empty ())
233
235
return -1000.0 ;
234
236
return static_cast <float >(atof (readValue.c_str ()));
@@ -412,14 +414,14 @@ void C1WireByOWFS::GetDevice(const std::string &inDir, const std::string &dirnam
412
414
device.devid =id;
413
415
414
416
device.filename =inDir;
415
- if (device.family == Environmental_Monitors || device. family == smart_battery_monitor ) {
416
- device.filename +=" /" + dirname + nameHelper (dirname); ;
417
+ if (device.family == Environmental_Monitors) {
418
+ device.filename +=" /" + dirname + nameHelper (dirname, device. family ) ;
417
419
} else {
418
420
device.filename +=" /" + dirname;
419
421
}
420
422
}
421
423
422
- std::string C1WireByOWFS::nameHelper (const std::string& dirname) const {
424
+ std::string C1WireByOWFS::nameHelper (const std::string& dirname, const _e1WireFamilyType family ) const {
423
425
std::string name;
424
426
DIR *d=NULL ;
425
427
@@ -432,7 +434,8 @@ std::string C1WireByOWFS::nameHelper(const std::string& dirname) const {
432
434
name = de->d_name ;
433
435
if (de->d_type == DT_DIR)
434
436
{
435
- if (name.compare (0 , 3 , " EDS" ) == 0 || name.compare (0 , 7 , " B1-R1-A" ) == 0 ) {
437
+ if ( ((family == Environmental_Monitors) && (name.compare (0 , 3 , " EDS" ) == 0 ))
438
+ || ((family == smart_battery_monitor) && (name.compare (0 , 7 , " B1-R1-A" ) == 0 )) ) {
436
439
closedir (d);
437
440
return " /" + name;
438
441
}
0 commit comments