correctly map pressure from bar to pascal in xdr

This commit is contained in:
andreas 2023-03-17 20:54:00 +01:00
parent fc7ca220db
commit 435654a3f6
2 changed files with 17 additions and 6 deletions

View File

@ -41,19 +41,20 @@ double ps2ph(double v)
GwXDRType *types[] = {
new GwXDRType(GwXDRType::PRESS, "P", "P"),
new GwXDRType(GwXDRType::PRESS, "P", "B",
BarToP,
PtoBar,
BarToP),
"P"),
new GwXDRType(GwXDRType::VOLT, "U", "V"),
new GwXDRType(GwXDRType::AMP, "I", "A"),
new GwXDRType(GwXDRType::TEMP, "C", "K"),
new GwXDRType(GwXDRType::TEMP, "C", "C", CToKelvin, KelvinToC),
new GwXDRType(GwXDRType::TEMP, "C", "C", CToKelvin, KelvinToC,"K"),
new GwXDRType(GwXDRType::HUMID, "H", "P"), //percent
new GwXDRType(GwXDRType::VOLPERCENT, "V", "P"),
new GwXDRType(GwXDRType::VOLUME, "V", "M", m3ToL, ltrTom3),
new GwXDRType(GwXDRType::VOLUME, "V", "M", m3ToL, ltrTom3,"L"),
new GwXDRType(GwXDRType::FLOW, "R", "I", ps2ph, ph2ps),
new GwXDRType(GwXDRType::GENERIC, "G", ""),
new GwXDRType(GwXDRType::DISPLACEMENT, "A", "P"),
new GwXDRType(GwXDRType::DISPLACEMENTD, "A", "D",DegToRad,RadToDeg),
new GwXDRType(GwXDRType::DISPLACEMENTD, "A", "D",DegToRad,RadToDeg,"rd"),
new GwXDRType(GwXDRType::RPM,"T","R"),
//important to have 2x NULL!
NULL,

View File

@ -44,14 +44,24 @@ class GwXDRType{
TypeCode code;
String xdrtype;
String xdrunit;
String boatDataUnit;
convert tonmea=NULL;
convert fromnmea=NULL;
GwXDRType(TypeCode tc,String xdrtype,String xdrunit,convert fromnmea=NULL,convert tonmea=NULL){
GwXDRType(TypeCode tc,String xdrtype,String xdrunit){
this->code=tc;
this->xdrtype=xdrtype;
this->xdrunit=xdrunit;
this->boatDataUnit=xdrunit;
this->fromnmea=fromnmea;
this->tonmea=tonmea;
}
GwXDRType(TypeCode tc,String xdrtype,String xdrunit,convert fromnmea,convert tonmea,String boatDataUnit=String()){
this->code=tc;
this->xdrtype=xdrtype;
this->xdrunit=xdrunit;
this->fromnmea=fromnmea;
this->tonmea=tonmea;
this->boatDataUnit=boatDataUnit.isEmpty()?xdrunit:boatDataUnit;
}
};
class GwXDRTypeMapping{
@ -183,7 +193,7 @@ class GwXDRFoundMapping : public GwBoatItemNameProvider{
return String("xdr")+getTransducerName();
};
virtual String getBoatItemFormat(){
return "formatXdr:"+type->xdrtype+":"+type->xdrunit;
return "formatXdr:"+type->xdrtype+":"+type->boatDataUnit;
};
virtual ~GwXDRFoundMapping(){}
};