Unit conversion working
This commit is contained in:
		
							parent
							
								
									f4ac126ae3
								
							
						
					
					
						commit
						0237ed761d
					
				| 
						 | 
					@ -5,44 +5,43 @@
 | 
				
			||||||
// ToDo
 | 
					// ToDo
 | 
				
			||||||
// simulation data
 | 
					// simulation data
 | 
				
			||||||
// hold values by missing data
 | 
					// hold values by missing data
 | 
				
			||||||
// different unit convertion
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
FormatedData formatValue(GwApi::BoatValue *value){
 | 
					FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
 | 
				
			||||||
//    GwApi *api;
 | 
					 | 
				
			||||||
    FormatedData result;
 | 
					    FormatedData result;
 | 
				
			||||||
/*
 | 
					
 | 
				
			||||||
    // Load configuration values
 | 
					    // Load configuration values
 | 
				
			||||||
    String lengthFormat = api->getConfig()->getConfigItem(api->getConfig()->lengthFormat,true)->asString();         // [m|ft]
 | 
					    int timeZone = commondata.config->getInt(commondata.config->timeZone);                      // [UTC -12...+12]
 | 
				
			||||||
    String distanceFormat = api->getConfig()->getConfigItem(api->getConfig()->distanceFormat,true)->asString();     // [m|km|nm]
 | 
					    String lengthFormat = commondata.config->getString(commondata.config->lengthFormat);        // [m|ft]
 | 
				
			||||||
    String speedFormat = api->getConfig()->getConfigItem(api->getConfig()->speedFormat,true)->asString();           // [m/s|km/h|kn]
 | 
					    String distanceFormat = commondata.config->getString(commondata.config->distanceFormat);    // [m|km|nm]
 | 
				
			||||||
    String windspeedFormat = api->getConfig()->getConfigItem(api->getConfig()->windspeedFormat,true)->asString();   // [m/s|km/h|kn|bft]
 | 
					    String speedFormat = commondata.config->getString(commondata.config->speedFormat);          // [m/s|km/h|kn]
 | 
				
			||||||
    String tempFormat = api->getConfig()->getConfigItem(api->getConfig()->tempFormat,true)->asString();             // [K|°C|°F]
 | 
					    String windspeedFormat = commondata.config->getString(commondata.config->windspeedFormat);  // [m/s|km/h|kn|bft]
 | 
				
			||||||
    String dateFormat = api->getConfig()->getConfigItem(api->getConfig()->dateFormat,true)->asString();             // [DE|GB|US]
 | 
					    String tempFormat = commondata.config->getString(commondata.config->tempFormat);            // [K|°C|°F]
 | 
				
			||||||
*/
 | 
					    String dateFormat = commondata.config->getString(commondata.config->dateFormat);            // [DE|GB|US]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (! value->valid){
 | 
					    if (! value->valid){
 | 
				
			||||||
        result.svalue = "---";
 | 
					        result.svalue = "---";
 | 
				
			||||||
        result.unit = "";
 | 
					        result.unit = "";
 | 
				
			||||||
        return result;
 | 
					        return result;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    static const int bsize=30;
 | 
					    static const int bsize = 30;
 | 
				
			||||||
    char buffer[bsize+1];
 | 
					    char buffer[bsize+1];
 | 
				
			||||||
    buffer[0]=0;
 | 
					    buffer[0]=0;
 | 
				
			||||||
    if (value->getFormat() == "formatDate"){
 | 
					    if (value->getFormat() == "formatDate"){
 | 
				
			||||||
        time_t tv=tNMEA0183Msg::daysToTime_t(value->value);
 | 
					        time_t tv=tNMEA0183Msg::daysToTime_t(value->value);
 | 
				
			||||||
        tmElements_t parts;
 | 
					        tmElements_t parts;
 | 
				
			||||||
        tNMEA0183Msg::breakTime(tv,parts);        
 | 
					        tNMEA0183Msg::breakTime(tv,parts);        
 | 
				
			||||||
/*        
 | 
					 | 
				
			||||||
        if(String(dateFormat) == "DE"){
 | 
					        if(String(dateFormat) == "DE"){
 | 
				
			||||||
            snprintf(buffer,bsize,"%02d.%02d.%04d",parts.tm_mday,parts.tm_mon+1,parts.tm_year+1900);
 | 
					            snprintf(buffer,bsize,"%02d.%02d.%04d",parts.tm_mday,parts.tm_mon+1,parts.tm_year+1900);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(String(dateFormat) == "GB"){
 | 
					        else if(String(dateFormat) == "GB"){
 | 
				
			||||||
            snprintf(buffer,bsize,"%02d/%02d/%04d",parts.tm_mday,parts.tm_mon+1,parts.tm_year+1900);
 | 
					            snprintf(buffer,bsize,"%02d/%02d/%04d",parts.tm_mday,parts.tm_mon+1,parts.tm_year+1900);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(String(dateFormat) == "US"){
 | 
					        else if(String(dateFormat) == "US"){
 | 
				
			||||||
            snprintf(buffer,bsize,"%02d/%02d/%04d",parts.tm_mon+1,parts.tm_mday,parts.tm_year+1900);
 | 
					            snprintf(buffer,bsize,"%02d/%02d/%04d",parts.tm_mon+1,parts.tm_mday,parts.tm_year+1900);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
*/
 | 
					        else{
 | 
				
			||||||
    snprintf(buffer,bsize,"%02d.%02d.%04d",parts.tm_mday,parts.tm_mon+1,parts.tm_year+1900);        
 | 
					            snprintf(buffer,bsize,"%02d.%02d.%04d",parts.tm_mday,parts.tm_mon+1,parts.tm_year+1900);  
 | 
				
			||||||
 | 
					        }        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if(value->getFormat() == "formatTime"){
 | 
					    else if(value->getFormat() == "formatTime"){
 | 
				
			||||||
        double inthr;
 | 
					        double inthr;
 | 
				
			||||||
| 
						 | 
					@ -50,10 +49,16 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
        double intsec;
 | 
					        double intsec;
 | 
				
			||||||
        double val;
 | 
					        double val;
 | 
				
			||||||
        val=modf(value->value/3600.0,&inthr);
 | 
					        val=modf(value->value/3600.0,&inthr);
 | 
				
			||||||
 | 
					        inthr += timeZone; 
 | 
				
			||||||
        val=modf(val*3600.0/60.0,&intmin);
 | 
					        val=modf(val*3600.0/60.0,&intmin);
 | 
				
			||||||
        modf(val*60.0,&intsec);
 | 
					        modf(val*60.0,&intsec);
 | 
				
			||||||
        snprintf(buffer,bsize,"%02.0f:%02.0f:%02.0f",inthr,intmin,intsec);
 | 
					        snprintf(buffer,bsize,"%02.0f:%02.0f:%02.0f",inthr,intmin,intsec);
 | 
				
			||||||
        result.unit = "";
 | 
					        if(timeZone == 0){
 | 
				
			||||||
 | 
					            result.unit = "UTC";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else{
 | 
				
			||||||
 | 
					            result.unit = "LOT";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (value->getFormat() == "formatFixed0"){
 | 
					    else if (value->getFormat() == "formatFixed0"){
 | 
				
			||||||
        snprintf(buffer,bsize,"%.0f",value->value);
 | 
					        snprintf(buffer,bsize,"%.0f",value->value);
 | 
				
			||||||
| 
						 | 
					@ -67,7 +72,7 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",course);
 | 
					            snprintf(buffer,bsize,"%2.1f",course);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(course >= 10 && course < 100){
 | 
					        if(course >= 10 && course < 100){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.1f",course);
 | 
					            snprintf(buffer,bsize,"%2.1f",course);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(course >= 100){
 | 
					        if(course >= 100){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.0f",course);
 | 
					            snprintf(buffer,bsize,"%3.0f",course);
 | 
				
			||||||
| 
						 | 
					@ -75,16 +80,73 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (value->getFormat() == "formatKnots" || value->getFormat() == "formatWind"){
 | 
					    else if (value->getFormat() == "formatKnots" || value->getFormat() == "formatWind"){
 | 
				
			||||||
        double speed = value->value;
 | 
					        double speed = value->value;
 | 
				
			||||||
        speed = speed * 1.94384;      // Unit conversion form m/s to kn
 | 
					        if(String(speedFormat) == "km/h" || String(windspeedFormat) == "km/h"){
 | 
				
			||||||
        result.unit = "kn";
 | 
					        speed = speed * 3.6;        // Unit conversion form m/s to km/h
 | 
				
			||||||
        if(speed < 10){
 | 
					            result.unit = "m/s";
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",speed);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(speed >= 10 && speed < 100){
 | 
					        else if(String(speedFormat) == "kn" || String(windspeedFormat) == "kn"){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.1f",speed);
 | 
					            speed = speed * 1.94384;      // Unit conversion form m/s to kn
 | 
				
			||||||
 | 
					            result.unit = "kn";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(speed >= 100){
 | 
					        else if(String(windspeedFormat) == "bft"){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.0f",speed);
 | 
					            if(speed < 0.3){
 | 
				
			||||||
 | 
					                speed = 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=0.3 && speed < 1.5){
 | 
				
			||||||
 | 
					                speed = 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=1.5 && speed < 3.3){
 | 
				
			||||||
 | 
					                speed = 2;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=3.3 && speed < 5.4){
 | 
				
			||||||
 | 
					                speed = 3;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=5.4 && speed < 7.9){
 | 
				
			||||||
 | 
					                speed = 4;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=7.9 && speed < 10.7){
 | 
				
			||||||
 | 
					                speed = 5;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=10.7 && speed < 13.8){
 | 
				
			||||||
 | 
					                speed = 6;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=13.8 && speed < 17.1){
 | 
				
			||||||
 | 
					                speed = 7;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=17.1 && speed < 20.7){
 | 
				
			||||||
 | 
					                speed = 8;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=20.7 && speed < 24.4){
 | 
				
			||||||
 | 
					                speed = 9;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=24.4 && speed < 28.4){
 | 
				
			||||||
 | 
					                speed = 10;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=28.4 && speed < 32.6){
 | 
				
			||||||
 | 
					                speed = 11;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >=32.6){
 | 
				
			||||||
 | 
					                speed = 12;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            result.unit = "bft";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else{
 | 
				
			||||||
 | 
					            speed = speed;              // Unit conversion form m/s to m/s
 | 
				
			||||||
 | 
					            result.unit = "m/s";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if(String(windspeedFormat) == "bft"){
 | 
				
			||||||
 | 
					            snprintf(buffer,bsize,"%2.0f",speed);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else{
 | 
				
			||||||
 | 
					            if(speed < 10){
 | 
				
			||||||
 | 
					                snprintf(buffer,bsize,"%2.1f",speed);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >= 10 && speed < 100){
 | 
				
			||||||
 | 
					                snprintf(buffer,bsize,"%2.1f",speed);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if(speed >= 100){
 | 
				
			||||||
 | 
					                snprintf(buffer,bsize,"%3.0f",speed);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (value->getFormat() == "formatRot"){
 | 
					    else if (value->getFormat() == "formatRot"){
 | 
				
			||||||
| 
						 | 
					@ -95,7 +157,7 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",rotation);
 | 
					            snprintf(buffer,bsize,"%2.1f",rotation);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(rotation >= 10 && rotation < 100){
 | 
					        if(rotation >= 10 && rotation < 100){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.1f",rotation);
 | 
					            snprintf(buffer,bsize,"%2.1f",rotation);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(rotation >= 100){
 | 
					        if(rotation >= 100){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.0f",rotation);
 | 
					            snprintf(buffer,bsize,"%3.0f",rotation);
 | 
				
			||||||
| 
						 | 
					@ -108,7 +170,7 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",dop);
 | 
					            snprintf(buffer,bsize,"%2.1f",dop);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(dop >= 10 && dop < 100){
 | 
					        if(dop >= 10 && dop < 100){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.1f",dop);
 | 
					            snprintf(buffer,bsize,"%2.1f",dop);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(dop >= 100){
 | 
					        if(dop >= 100){
 | 
				
			||||||
            snprintf(buffer,bsize,"%3.0f",dop);
 | 
					            snprintf(buffer,bsize,"%3.0f",dop);
 | 
				
			||||||
| 
						 | 
					@ -150,7 +212,13 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (value->getFormat() == "formatDepth"){
 | 
					    else if (value->getFormat() == "formatDepth"){
 | 
				
			||||||
        double depth = value->value;
 | 
					        double depth = value->value;
 | 
				
			||||||
        result.unit = "m";
 | 
					        if(String(lengthFormat) == "ft"){
 | 
				
			||||||
 | 
					            depth = depth * 3.28084;
 | 
				
			||||||
 | 
					            result.unit = "ft";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else{
 | 
				
			||||||
 | 
					             result.unit = "m";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if(depth < 10){
 | 
					        if(depth < 10){
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",depth);
 | 
					            snprintf(buffer,bsize,"%2.1f",depth);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -163,8 +231,17 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (value->getFormat() == "kelvinToC"){
 | 
					    else if (value->getFormat() == "kelvinToC"){
 | 
				
			||||||
        double temp = value->value;
 | 
					        double temp = value->value;
 | 
				
			||||||
        temp = temp - 273.15;
 | 
					        if(String(tempFormat) == "°C"){
 | 
				
			||||||
        result.unit = "degree";
 | 
					            temp = temp - 273.15;
 | 
				
			||||||
 | 
					            result.unit = "C";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if(String(tempFormat) == "°F"){
 | 
				
			||||||
 | 
					            temp = temp - 459.67;
 | 
				
			||||||
 | 
					            result.unit = "F";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else{
 | 
				
			||||||
 | 
					            result.unit = "K";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if(temp < 10){
 | 
					        if(temp < 10){
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",temp);
 | 
					            snprintf(buffer,bsize,"%2.1f",temp);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -177,8 +254,18 @@ FormatedData formatValue(GwApi::BoatValue *value){
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (value->getFormat() == "mtr2nm"){
 | 
					    else if (value->getFormat() == "mtr2nm"){
 | 
				
			||||||
        double distance = value->value;
 | 
					        double distance = value->value;
 | 
				
			||||||
        distance = distance * 0.000539957;
 | 
					        if(String(distanceFormat) == "km"){
 | 
				
			||||||
        result.unit = "nm";
 | 
					            distance = distance * 0.001;
 | 
				
			||||||
 | 
					            result.unit = "km";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if(String(distanceFormat) == "nm"){
 | 
				
			||||||
 | 
					            distance = distance * 0.000539957;
 | 
				
			||||||
 | 
					            result.unit = "nm";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else{
 | 
				
			||||||
 | 
					            distance = distance * 0.000539957;
 | 
				
			||||||
 | 
					            result.unit = "m";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if(distance < 10){
 | 
					        if(distance < 10){
 | 
				
			||||||
            snprintf(buffer,bsize,"%2.1f",distance);
 | 
					            snprintf(buffer,bsize,"%2.1f",distance);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,15 +13,17 @@ class PageOneValue : public Page{
 | 
				
			||||||
        String displaycolor = config->getString(config->displaycolor);
 | 
					        String displaycolor = config->getString(config->displaycolor);
 | 
				
			||||||
        bool holdvalues = config->getBool(config->holdvalues);
 | 
					        bool holdvalues = config->getBool(config->holdvalues);
 | 
				
			||||||
        String flashLED = config->getString(config->flashLED);
 | 
					        String flashLED = config->getString(config->flashLED);
 | 
				
			||||||
 | 
					        String backlightMode = config->getString(config->backlight);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        // Get boat values
 | 
					        // Get boat values
 | 
				
			||||||
        GwApi::BoatValue *bvalue=pageData.values[0];    // First element in list (only one value by PageOneValue)
 | 
					        GwApi::BoatValue *bvalue=pageData.values[0];    // First element in list (only one value by PageOneValue)
 | 
				
			||||||
        String name1 = bvalue->getName().c_str();       // Value name
 | 
					        String name1 = bvalue->getName().c_str();       // Value name
 | 
				
			||||||
 | 
					        name1 = name1.substring(0, 6);                  // String length limit for value name
 | 
				
			||||||
        double value1 = bvalue->value;                  // Value as double in SI unit
 | 
					        double value1 = bvalue->value;                  // Value as double in SI unit
 | 
				
			||||||
        String svalue1 = formatValue(bvalue).svalue;    // Formatted value as string including unit conversion and switching decimal places
 | 
					        String svalue1 = formatValue(bvalue, commonData).svalue;    // Formatted value as string including unit conversion and switching decimal places
 | 
				
			||||||
        String unit1 = formatValue(bvalue).unit;        // Unit of value
 | 
					        String unit1 = formatValue(bvalue, commonData).unit;        // Unit of value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Optical warning by limit violation
 | 
					        // Optical warning by limit violation (unused)
 | 
				
			||||||
        if(String(flashLED) == "Limit Violation"){
 | 
					        if(String(flashLED) == "Limit Violation"){
 | 
				
			||||||
            setBlinkingLED(false);
 | 
					            setBlinkingLED(false);
 | 
				
			||||||
            setPortPin(OBP_FLASH_LED, false); 
 | 
					            setPortPin(OBP_FLASH_LED, false); 
 | 
				
			||||||
| 
						 | 
					@ -89,8 +91,10 @@ class PageOneValue : public Page{
 | 
				
			||||||
        display.setFont(&Ubuntu_Bold8pt7b);
 | 
					        display.setFont(&Ubuntu_Bold8pt7b);
 | 
				
			||||||
        display.setCursor(115, 290);
 | 
					        display.setCursor(115, 290);
 | 
				
			||||||
        display.print(" [  <<<<<<      >>>>>>  ]");
 | 
					        display.print(" [  <<<<<<      >>>>>>  ]");
 | 
				
			||||||
        display.setCursor(343, 290);
 | 
					        if(String(backlightMode) == "Control by Key"){
 | 
				
			||||||
        display.print("[ILUM]");
 | 
					            display.setCursor(343, 290);
 | 
				
			||||||
 | 
					            display.print("[ILUM]");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Update display
 | 
					        // Update display
 | 
				
			||||||
        display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true);    // Partial update (fast)
 | 
					        display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true);    // Partial update (fast)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,4 +68,4 @@ typedef struct{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Formater for boat values
 | 
					// Formater for boat values
 | 
				
			||||||
FormatedData formatValue(GwApi::BoatValue *value);
 | 
					FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -365,6 +365,9 @@ void OBP60Task(GwApi *api){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Task Loop
 | 
					    // Task Loop
 | 
				
			||||||
    //###############################
 | 
					    //###############################
 | 
				
			||||||
 | 
					    GwApi::BoatValue *hdop = boatValues.findValueOrCreate("HDOP");  // Load HDOP
 | 
				
			||||||
 | 
					    String gpsFix = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LOG_DEBUG(GwLog::LOG,"obp60task: start mainloop");
 | 
					    LOG_DEBUG(GwLog::LOG,"obp60task: start mainloop");
 | 
				
			||||||
    int pageNumber=0;
 | 
					    int pageNumber=0;
 | 
				
			||||||
    int lastPage=pageNumber;
 | 
					    int lastPage=pageNumber;
 | 
				
			||||||
| 
						 | 
					@ -389,9 +392,6 @@ void OBP60Task(GwApi *api){
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // If GPS fix then LED on (HDOP)
 | 
					            // If GPS fix then LED on (HDOP)
 | 
				
			||||||
            String gpsFix = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString();
 | 
					 | 
				
			||||||
            GwApi::BoatValue *hdop;
 | 
					 | 
				
			||||||
            hdop = boatValues.findValueOrCreate("HDOP");
 | 
					 | 
				
			||||||
            if(String(gpsFix) == "GPS Fix" && hdop->valid == true && int(hdop->value) <= 50){
 | 
					            if(String(gpsFix) == "GPS Fix" && hdop->valid == true && int(hdop->value) <= 50){
 | 
				
			||||||
                setPortPin(OBP_FLASH_LED, true);
 | 
					                setPortPin(OBP_FLASH_LED, true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -457,12 +457,12 @@ void OBP60Task(GwApi *api){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //handle the page
 | 
					            //handle the page
 | 
				
			||||||
            if (pages[pageNumber].description && pages[pageNumber].description->header){
 | 
					            if (pages[pageNumber].description && pages[pageNumber].description->header){
 | 
				
			||||||
 | 
					 | 
				
			||||||
            //build some header and footer using commonData
 | 
					            //build some header and footer using commonData
 | 
				
			||||||
 | 
					            display.setFont(&Ubuntu_Bold32pt7b);
 | 
				
			||||||
 | 
					            display.setCursor(20, 100);
 | 
				
			||||||
 | 
					            display.print("Hallo");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            //....
 | 
					            
 | 
				
			||||||
            //call the particular page
 | 
					            //call the particular page
 | 
				
			||||||
            Page *currentPage=pages[pageNumber].page;
 | 
					            Page *currentPage=pages[pageNumber].page;
 | 
				
			||||||
            if (currentPage == NULL){
 | 
					            if (currentPage == NULL){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue