Fix simulation data for several pages
This commit is contained in:
parent
726b1abf2d
commit
c63742e707
|
@ -324,10 +324,15 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
|
||||||
getdisplay().print("LOT");
|
getdisplay().print("LOT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(commonData.config->getBool(commonData.config->useSimuData) == true){
|
||||||
|
getdisplay().print("12:00 01.01.2024 LOT");
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
getdisplay().print("No GPS data");
|
getdisplay().print("No GPS data");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sunset und sunrise calculation
|
// Sunset und sunrise calculation
|
||||||
|
|
|
@ -12,6 +12,7 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
GwLog *logger = commondata.logger;
|
GwLog *logger = commondata.logger;
|
||||||
FormatedData result;
|
FormatedData result;
|
||||||
static int dayoffset = 0;
|
static int dayoffset = 0;
|
||||||
|
double rawvalue = 0;
|
||||||
|
|
||||||
// Load configuration values
|
// Load configuration values
|
||||||
String stimeZone = commondata.config->getString(commondata.config->timeZone); // [UTC -14.00...+12.00]
|
String stimeZone = commondata.config->getString(commondata.config->timeZone); // [UTC -14.00...+12.00]
|
||||||
|
@ -112,9 +113,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
else if (value->getFormat() == "formatFixed0"){
|
else if (value->getFormat() == "formatFixed0"){
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
snprintf(buffer,bsize,"%3.0f",value->value);
|
snprintf(buffer,bsize,"%3.0f",value->value);
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
snprintf(buffer,bsize,"%3.0f", 8.0 + float(random(0, 10)) / 10.0);
|
rawvalue = 8.0 + float(random(0, 10)) / 10.0;
|
||||||
|
snprintf(buffer,bsize,"%3.0f", rawvalue);
|
||||||
}
|
}
|
||||||
result.unit = "";
|
result.unit = "";
|
||||||
}
|
}
|
||||||
|
@ -123,9 +126,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double course = 0;
|
double course = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
course = value->value;
|
course = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
course = 2.53 + float(random(0, 10) / 100.0);
|
course = 2.53 + float(random(0, 10) / 100.0);
|
||||||
|
rawvalue = course;
|
||||||
}
|
}
|
||||||
course = course * 57.2958; // Unit conversion form rad to deg
|
course = course * 57.2958; // Unit conversion form rad to deg
|
||||||
|
|
||||||
|
@ -138,9 +143,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double speed = 0;
|
double speed = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
speed = value->value;
|
speed = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
speed = 4.0 + float(random(0, 40));
|
rawvalue = 4.0 + float(random(0, 40));
|
||||||
|
speed = rawvalue;
|
||||||
}
|
}
|
||||||
if(String(speedFormat) == "km/h"){
|
if(String(speedFormat) == "km/h"){
|
||||||
speed = speed * 3.6; // Unit conversion form m/s to km/h
|
speed = speed * 3.6; // Unit conversion form m/s to km/h
|
||||||
|
@ -169,9 +176,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double speed = 0;
|
double speed = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
speed = value->value;
|
speed = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
speed = 4.0 + float(random(0, 40));
|
rawvalue = 4.0 + float(random(0, 40));
|
||||||
|
speed = rawvalue;
|
||||||
}
|
}
|
||||||
if(String(windspeedFormat) == "km/h"){
|
if(String(windspeedFormat) == "km/h"){
|
||||||
speed = speed * 3.6; // Unit conversion form m/s to km/h
|
speed = speed * 3.6; // Unit conversion form m/s to km/h
|
||||||
|
@ -247,9 +256,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double rotation = 0;
|
double rotation = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
rotation = value->value;
|
rotation = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
rotation = 0.04 + float(random(0, 10)) / 100.0;
|
rawvalue = 0.04 + float(random(0, 10)) / 100.0;
|
||||||
|
rotation = rawvalue;
|
||||||
}
|
}
|
||||||
rotation = rotation * 57.2958; // Unit conversion form rad/s to deg/s
|
rotation = rotation * 57.2958; // Unit conversion form rad/s to deg/s
|
||||||
result.unit = "Deg/s";
|
result.unit = "Deg/s";
|
||||||
|
@ -271,9 +282,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double dop = 0;
|
double dop = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
dop = value->value;
|
dop = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
dop = 2.0 + float(random(0, 40)) / 10.0;
|
rawvalue = 2.0 + float(random(0, 40)) / 10.0;
|
||||||
|
dop = rawvalue;
|
||||||
}
|
}
|
||||||
result.unit = "m";
|
result.unit = "m";
|
||||||
if(dop > 99.9){
|
if(dop > 99.9){
|
||||||
|
@ -290,6 +303,7 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
else if (value->getFormat() == "formatLatitude"){
|
else if (value->getFormat() == "formatLatitude"){
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
double lat = value->value;
|
double lat = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
String latitude = "";
|
String latitude = "";
|
||||||
String latdir = "";
|
String latdir = "";
|
||||||
float degree = abs(int(lat));
|
float degree = abs(int(lat));
|
||||||
|
@ -305,13 +319,15 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
strcpy(buffer, latitude.c_str());
|
strcpy(buffer, latitude.c_str());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
snprintf(buffer,bsize," 51\" %2.4f' N", 35.0 + float(random(0, 10)) / 10000.0);
|
rawvalue = 35.0 + float(random(0, 10)) / 10000.0;
|
||||||
|
snprintf(buffer,bsize," 51\" %2.4f' N", rawvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//########################################################
|
//########################################################
|
||||||
else if (value->getFormat() == "formatLongitude"){
|
else if (value->getFormat() == "formatLongitude"){
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
double lon = value->value;
|
double lon = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
String longitude = "";
|
String longitude = "";
|
||||||
String londir = "";
|
String londir = "";
|
||||||
float degree = abs(int(lon));
|
float degree = abs(int(lon));
|
||||||
|
@ -327,7 +343,8 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
strcpy(buffer, longitude.c_str());
|
strcpy(buffer, longitude.c_str());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
snprintf(buffer,bsize," 15\" %2.4f'", 6.0 + float(random(0, 10)) / 100000.0);
|
rawvalue = 6.0 + float(random(0, 10)) / 100000.0;
|
||||||
|
snprintf(buffer,bsize," 15\" %2.4f'", rawvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//########################################################
|
//########################################################
|
||||||
|
@ -335,9 +352,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double depth = 0;
|
double depth = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
depth = value->value;
|
depth = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
depth = 18.0 + float(random(0, 100)) / 10.0;
|
rawvalue = 18.0 + float(random(0, 100)) / 10.0;
|
||||||
|
depth = rawvalue;
|
||||||
}
|
}
|
||||||
if(String(lengthFormat) == "ft"){
|
if(String(lengthFormat) == "ft"){
|
||||||
depth = depth * 3.28084;
|
depth = depth * 3.28084;
|
||||||
|
@ -361,9 +380,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double temp = 0;
|
double temp = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
temp = value->value;
|
temp = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
temp = 296.0 + float(random(0, 10)) / 10.0;
|
rawvalue = 296.0 + float(random(0, 10)) / 10.0;
|
||||||
|
temp = rawvalue;
|
||||||
}
|
}
|
||||||
if(String(tempFormat) == "C"){
|
if(String(tempFormat) == "C"){
|
||||||
temp = temp - 273.15;
|
temp = temp - 273.15;
|
||||||
|
@ -391,9 +412,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double distance = 0;
|
double distance = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
distance = value->value;
|
distance = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
distance = 2960.0 + float(random(0, 10));
|
rawvalue = 2960.0 + float(random(0, 10));
|
||||||
|
distance = rawvalue;
|
||||||
}
|
}
|
||||||
if(String(distanceFormat) == "km"){
|
if(String(distanceFormat) == "km"){
|
||||||
distance = distance * 0.001;
|
distance = distance * 0.001;
|
||||||
|
@ -424,22 +447,26 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double pressure = 0;
|
double pressure = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
pressure = value->value;
|
pressure = value->value;
|
||||||
pressure = pressure; // Unit conversion form Pa to mBar
|
rawvalue = value->value;
|
||||||
|
pressure = pressure / 100.0; // Unit conversion form Pa to hPa
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
pressure = 968 + float(random(0, 10));
|
rawvalue = 968 + float(random(0, 10));
|
||||||
|
pressure = rawvalue;
|
||||||
}
|
}
|
||||||
snprintf(buffer,bsize,"%4.0f",pressure);
|
snprintf(buffer,bsize,"%4.0f",pressure);
|
||||||
result.unit = "mBar";
|
result.unit = "hPa";
|
||||||
}
|
}
|
||||||
//########################################################
|
//########################################################
|
||||||
else if (value->getFormat() == "formatXdr:P:B"){
|
else if (value->getFormat() == "formatXdr:P:B"){
|
||||||
double pressure = 0;
|
double pressure = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
pressure = value->value;
|
pressure = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
pressure = pressure / 100.0; // Unit conversion form Pa to mBar
|
pressure = pressure / 100.0; // Unit conversion form Pa to mBar
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
rawvalue = value->value;
|
||||||
pressure = 968 + float(random(0, 10));
|
pressure = 968 + float(random(0, 10));
|
||||||
}
|
}
|
||||||
snprintf(buffer,bsize,"%4.0f",pressure);
|
snprintf(buffer,bsize,"%4.0f",pressure);
|
||||||
|
@ -450,9 +477,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double voltage = 0;
|
double voltage = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
voltage = value->value;
|
voltage = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
voltage = 12 + float(random(0, 30)) / 10.0;
|
rawvalue = 12 + float(random(0, 30)) / 10.0;
|
||||||
|
voltage = rawvalue;
|
||||||
}
|
}
|
||||||
if(voltage < 10){
|
if(voltage < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",voltage);
|
snprintf(buffer,bsize,"%3.2f",voltage);
|
||||||
|
@ -467,9 +496,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double current = 0;
|
double current = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
current = value->value;
|
current = value->value;
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
current = 8.2 + float(random(0, 50)) / 10.0;
|
rawvalue = 8.2 + float(random(0, 50)) / 10.0;
|
||||||
|
current = rawvalue;
|
||||||
}
|
}
|
||||||
if(current < 10){
|
if(current < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",current);
|
snprintf(buffer,bsize,"%3.2f",current);
|
||||||
|
@ -487,9 +518,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double temperature = 0;
|
double temperature = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
temperature = value->value - 273.15; // Convert K to C
|
temperature = value->value - 273.15; // Convert K to C
|
||||||
|
rawvalue = value->value - 273.15;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
temperature = 21.8 + float(random(0, 50)) / 10.0;
|
rawvalue = 21.8 + float(random(0, 50)) / 10.0;
|
||||||
|
temperature = rawvalue;
|
||||||
}
|
}
|
||||||
if(temperature < 10){
|
if(temperature < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",temperature);
|
snprintf(buffer,bsize,"%3.2f",temperature);
|
||||||
|
@ -507,9 +540,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double temperature = 0;
|
double temperature = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
temperature = value->value; // Value in C
|
temperature = value->value; // Value in C
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
temperature = 21.8 + float(random(0, 50)) / 10.0;
|
rawvalue = 21.8 + float(random(0, 50)) / 10.0;
|
||||||
|
temperature = rawvalue;
|
||||||
}
|
}
|
||||||
if(temperature < 10){
|
if(temperature < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",temperature);
|
snprintf(buffer,bsize,"%3.2f",temperature);
|
||||||
|
@ -527,9 +562,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double humidity = 0;
|
double humidity = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
humidity = value->value; // Value in %
|
humidity = value->value; // Value in %
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
humidity = 41.3 + float(random(0, 50)) / 10.0;
|
rawvalue = 41.3 + float(random(0, 50)) / 10.0;
|
||||||
|
humidity = rawvalue;
|
||||||
}
|
}
|
||||||
if(humidity < 10){
|
if(humidity < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",humidity);
|
snprintf(buffer,bsize,"%3.2f",humidity);
|
||||||
|
@ -547,9 +584,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double volume = 0;
|
double volume = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
volume = value->value; // Value in %
|
volume = value->value; // Value in %
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
volume = 85.8 + float(random(0, 50)) / 10.0;
|
rawvalue = 85.8 + float(random(0, 50)) / 10.0;
|
||||||
|
volume = rawvalue;
|
||||||
}
|
}
|
||||||
if(volume < 10){
|
if(volume < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",volume);
|
snprintf(buffer,bsize,"%3.2f",volume);
|
||||||
|
@ -567,9 +606,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double volume = 0;
|
double volume = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
volume = value->value; // Value in l
|
volume = value->value; // Value in l
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
volume = 75.2 + float(random(0, 50)) / 10.0;
|
rawvalue = 75.2 + float(random(0, 50)) / 10.0;
|
||||||
|
volume = rawvalue;
|
||||||
}
|
}
|
||||||
if(volume < 10){
|
if(volume < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",volume);
|
snprintf(buffer,bsize,"%3.2f",volume);
|
||||||
|
@ -587,9 +628,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double flow = 0;
|
double flow = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
flow = value->value; // Value in l/min
|
flow = value->value; // Value in l/min
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
flow = 7.5 + float(random(0, 20)) / 10.0;
|
rawvalue = 7.5 + float(random(0, 20)) / 10.0;
|
||||||
|
flow = rawvalue;
|
||||||
}
|
}
|
||||||
if(flow < 10){
|
if(flow < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",flow);
|
snprintf(buffer,bsize,"%3.2f",flow);
|
||||||
|
@ -607,9 +650,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double generic = 0;
|
double generic = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
generic = value->value; // Value in l/min
|
generic = value->value; // Value in l/min
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
generic = 18.5 + float(random(0, 20)) / 10.0;
|
rawvalue = 18.5 + float(random(0, 20)) / 10.0;
|
||||||
|
generic = rawvalue;
|
||||||
}
|
}
|
||||||
if(generic < 10){
|
if(generic < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",generic);
|
snprintf(buffer,bsize,"%3.2f",generic);
|
||||||
|
@ -627,9 +672,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double dplace = 0;
|
double dplace = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
dplace = value->value; // Value in %
|
dplace = value->value; // Value in %
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
dplace = 55.3 + float(random(0, 20)) / 10.0;
|
rawvalue = 55.3 + float(random(0, 20)) / 10.0;
|
||||||
|
dplace = rawvalue;
|
||||||
}
|
}
|
||||||
if(dplace < 10){
|
if(dplace < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",dplace);
|
snprintf(buffer,bsize,"%3.2f",dplace);
|
||||||
|
@ -648,9 +695,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
angle = value->value;
|
angle = value->value;
|
||||||
angle = angle * 57.2958; // Unit conversion form rad to deg
|
angle = angle * 57.2958; // Unit conversion form rad to deg
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
angle = 20 + random(-5, 5);
|
rawvalue = PI / 100 + (random(-5, 5) / 360 * 2* PI);
|
||||||
|
angle = rawvalue * 57.2958;
|
||||||
}
|
}
|
||||||
if(angle > -10 && angle < 10){
|
if(angle > -10 && angle < 10){
|
||||||
snprintf(buffer,bsize,"%3.1f",angle);
|
snprintf(buffer,bsize,"%3.1f",angle);
|
||||||
|
@ -665,9 +714,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
double rpm = 0;
|
double rpm = 0;
|
||||||
if(usesimudata == false) {
|
if(usesimudata == false) {
|
||||||
rpm = value->value; // Value in rpm
|
rpm = value->value; // Value in rpm
|
||||||
|
rawvalue = value->value;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
rpm = 2505 + random(0, 20);
|
rawvalue = 2505 + random(0, 20);
|
||||||
|
rpm = rawvalue;
|
||||||
}
|
}
|
||||||
if(rpm < 10){
|
if(rpm < 10){
|
||||||
snprintf(buffer,bsize,"%3.2f",rpm);
|
snprintf(buffer,bsize,"%3.2f",rpm);
|
||||||
|
@ -696,6 +747,7 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
result.unit = "";
|
result.unit = "";
|
||||||
}
|
}
|
||||||
buffer[bsize]=0;
|
buffer[bsize]=0;
|
||||||
|
result.value = rawvalue; // Return value is only necessary in case of simulation of graphic pointer
|
||||||
result.svalue = String(buffer);
|
result.svalue = String(buffer);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ public:
|
||||||
// Draw keel position pointer
|
// Draw keel position pointer
|
||||||
float startwidth = 8; // Start width of pointer
|
float startwidth = 8; // Start width of pointer
|
||||||
|
|
||||||
if(rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true || simulation == true)){
|
if((rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true)) || simulation == true){
|
||||||
float sinx=sin(value1);
|
float sinx=sin(value1);
|
||||||
float cosx=cos(value1);
|
float cosx=cos(value1);
|
||||||
// Normal pointer
|
// Normal pointer
|
||||||
|
@ -210,7 +210,7 @@ public:
|
||||||
getdisplay().setCursor(100, 70);
|
getdisplay().setCursor(100, 70);
|
||||||
getdisplay().print("Keel Position"); // Label
|
getdisplay().print("Keel Position"); // Label
|
||||||
|
|
||||||
if(rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true || simulation == true)){
|
if((rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true)) || simulation == true){
|
||||||
// Print Unit of keel position
|
// Print Unit of keel position
|
||||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||||
getdisplay().setCursor(175, 110);
|
getdisplay().setCursor(175, 110);
|
||||||
|
|
|
@ -27,17 +27,13 @@ public:
|
||||||
GwConfigHandler *config = commonData.config;
|
GwConfigHandler *config = commonData.config;
|
||||||
GwLog *logger=commonData.logger;
|
GwLog *logger=commonData.logger;
|
||||||
|
|
||||||
static String svalue1old = "";
|
|
||||||
static String unit1old = "";
|
|
||||||
static String svalue2old = "";
|
|
||||||
static String unit2old = "";
|
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
double value2 = 0;
|
double value2 = 0;
|
||||||
String svalue1 = "";
|
String svalue1 = "";
|
||||||
String unit1 = "";
|
String svalue1old = "";
|
||||||
String svalue2 = "";
|
String svalue2 = "";
|
||||||
String unit2 = "";
|
String svalue2old = "";
|
||||||
|
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
|
@ -63,7 +59,6 @@ public:
|
||||||
else{
|
else{
|
||||||
if(simulation == true){
|
if(simulation == true){
|
||||||
value1 = (20 + float(random(0, 50)) / 10.0)/360*2*PI;
|
value1 = (20 + float(random(0, 50)) / 10.0)/360*2*PI;
|
||||||
unit1 = "Deg";
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value1 = 0;
|
value1 = 0;
|
||||||
|
@ -75,11 +70,6 @@ public:
|
||||||
else{
|
else{
|
||||||
svalue1 = String(value1/(2*PI)*360,0);
|
svalue1 = String(value1/(2*PI)*360,0);
|
||||||
}
|
}
|
||||||
unit1 = formatValue(bvalue1, commonData).unit; // Unit of value
|
|
||||||
if(valid1 == true){
|
|
||||||
svalue1old = svalue1; // Save old value
|
|
||||||
unit1old = unit1; // Save old unit
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get boat values for pitch
|
// Get boat values for pitch
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (xdrPitch)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (xdrPitch)
|
||||||
|
@ -92,7 +82,6 @@ public:
|
||||||
else{
|
else{
|
||||||
if(simulation == true){
|
if(simulation == true){
|
||||||
value2 = (float(random(-5, 5)))/360*2*PI;
|
value2 = (float(random(-5, 5)))/360*2*PI;
|
||||||
unit2 = "Deg";
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value2 = 0;
|
value2 = 0;
|
||||||
|
@ -104,16 +93,11 @@ public:
|
||||||
else{
|
else{
|
||||||
svalue2 = String(value2/(2*PI)*360,0);
|
svalue2 = String(value2/(2*PI)*360,0);
|
||||||
}
|
}
|
||||||
unit2 = formatValue(bvalue2, commonData).unit; // Unit of value
|
|
||||||
if(valid2 == true){
|
|
||||||
svalue2old = svalue2; // Save old value
|
|
||||||
unit2old = unit2; // Save old unit
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optical warning by limit violation
|
// Optical warning by limit violation
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
// Limits for roll
|
// Limits for roll
|
||||||
if(value1*360/(2*PI) > -1*rolllimit && value1*360/(2*PI) < rolllimit){
|
if(value1*360/(2*PI) >= -1*rolllimit && value1*360/(2*PI) <= rolllimit){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
setFlashLED(false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
|
@ -146,6 +130,18 @@ public:
|
||||||
// Set display in partial refresh mode
|
// Set display in partial refresh mode
|
||||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||||
|
|
||||||
|
// Show roll limit
|
||||||
|
getdisplay().setTextColor(textcolor);
|
||||||
|
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||||
|
getdisplay().setCursor(10, 65);
|
||||||
|
getdisplay().print(rolllimit); // Value
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||||
|
getdisplay().setCursor(10, 95);
|
||||||
|
getdisplay().print("Limit"); // Name
|
||||||
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
getdisplay().setCursor(10, 115);
|
||||||
|
getdisplay().print("DEG");
|
||||||
|
|
||||||
// Horizintal separator left
|
// Horizintal separator left
|
||||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||||
|
|
||||||
|
@ -160,9 +156,7 @@ public:
|
||||||
getdisplay().print(name1); // Name
|
getdisplay().print(name1); // Name
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
getdisplay().setCursor(10, 190);
|
getdisplay().setCursor(10, 190);
|
||||||
getdisplay().print(" ");
|
getdisplay().print("Deg");
|
||||||
if(holdvalues == false) getdisplay().print(unit1); // Unit
|
|
||||||
else getdisplay().print(unit1old);
|
|
||||||
|
|
||||||
// Horizintal separator right
|
// Horizintal separator right
|
||||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||||
|
@ -178,9 +172,7 @@ public:
|
||||||
getdisplay().print(name2); // Name
|
getdisplay().print(name2); // Name
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
getdisplay().setCursor(335, 190);
|
getdisplay().setCursor(335, 190);
|
||||||
getdisplay().print(" ");
|
getdisplay().print("Deg");
|
||||||
if(holdvalues == false) getdisplay().print(unit1); // Unit
|
|
||||||
else getdisplay().print(unit1old);
|
|
||||||
|
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,15 @@ public:
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(simulation == true){
|
||||||
|
value1 = (3 + float(random(0, 50)) / 10.0)/360*2*PI;
|
||||||
|
unit1 = "Deg";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
value1 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
// bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
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);
|
||||||
|
@ -55,6 +55,7 @@ public:
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
|
value1 = formatValue(bvalue1, commonData).value;// Format only nesaccery for simulation data for pointer
|
||||||
String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value
|
String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
|
@ -309,7 +310,7 @@ public:
|
||||||
|
|
||||||
// Draw wind pointer
|
// Draw wind pointer
|
||||||
float startwidth = 8; // Start width of pointer
|
float startwidth = 8; // Start width of pointer
|
||||||
if(valid2 == true || holdvalues == true){
|
if(valid2 == true || holdvalues == true || simulation == true){
|
||||||
float sinx=sin(value1); // Wind direction
|
float sinx=sin(value1); // Wind direction
|
||||||
float cosx=cos(value1);
|
float cosx=cos(value1);
|
||||||
// Normal pointer
|
// Normal pointer
|
||||||
|
|
|
@ -11,19 +11,20 @@ typedef struct{
|
||||||
ValueList values;
|
ValueList values;
|
||||||
} PageData;
|
} PageData;
|
||||||
|
|
||||||
|
// Sensor data structure (only for extended sensors, not for NMEA bus sensors)
|
||||||
typedef struct{
|
typedef struct{
|
||||||
int actpage = 0;
|
int actpage = 0;
|
||||||
int maxpage = 0;
|
int maxpage = 0;
|
||||||
double batteryVoltage = 0;
|
double batteryVoltage = 0;
|
||||||
double batteryCurrent = 0;
|
double batteryCurrent = 0;
|
||||||
double batteryPower = 0;
|
double batteryPower = 0;
|
||||||
double batteryVoltage10 = 0;
|
double batteryVoltage10 = 0; // Sliding average over 10 values
|
||||||
double batteryCurrent10 = 0;
|
double batteryCurrent10 = 0;
|
||||||
double batteryPower10 = 0;
|
double batteryPower10 = 0;
|
||||||
double batteryVoltage60 = 0;
|
double batteryVoltage60 = 0; // Sliding average over 60 values
|
||||||
double batteryCurrent60 = 0;
|
double batteryCurrent60 = 0;
|
||||||
double batteryPower60 = 0;
|
double batteryPower60 = 0;
|
||||||
double batteryVoltage300 = 0;
|
double batteryVoltage300 = 0; // Sliding average over 300 values
|
||||||
double batteryCurrent300 = 0;
|
double batteryCurrent300 = 0;
|
||||||
double batteryPower300 = 0;
|
double batteryPower300 = 0;
|
||||||
double solarVoltage = 0;
|
double solarVoltage = 0;
|
||||||
|
@ -42,7 +43,7 @@ typedef struct{
|
||||||
double onewireTemp5 = 0;
|
double onewireTemp5 = 0;
|
||||||
double onewireTemp6 = 0;
|
double onewireTemp6 = 0;
|
||||||
double rotationAngle = 0; // Rotation angle in radiant
|
double rotationAngle = 0; // Rotation angle in radiant
|
||||||
bool validRotAngle = false; // Valid flag for magnet present
|
bool validRotAngle = false; // Valid flag magnet present for potation sensor
|
||||||
int sunsetHour = 0;
|
int sunsetHour = 0;
|
||||||
int sunsetMinute = 0;
|
int sunsetMinute = 0;
|
||||||
int sunriseHour = 0;
|
int sunriseHour = 0;
|
||||||
|
@ -112,6 +113,7 @@ class PageDescription{
|
||||||
|
|
||||||
// Structure for formated boat values
|
// Structure for formated boat values
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
double value;
|
||||||
String svalue;
|
String svalue;
|
||||||
String unit;
|
String unit;
|
||||||
} FormatedData;
|
} FormatedData;
|
||||||
|
|
|
@ -460,7 +460,7 @@
|
||||||
"name": "rollLimit",
|
"name": "rollLimit",
|
||||||
"label": "Roll Limit",
|
"label": "Roll Limit",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": "40",
|
"default": "25",
|
||||||
"check": "checkMinMax",
|
"check": "checkMinMax",
|
||||||
"min": -90,
|
"min": -90,
|
||||||
"max": 90,
|
"max": 90,
|
||||||
|
@ -622,7 +622,7 @@
|
||||||
"label": "Refresh",
|
"label": "Refresh",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": "true",
|
"default": "true",
|
||||||
"description": "Refresh E-Ink display after each new page request to reduce shadows [on|off]",
|
"description": "Refresh E-Ink display after each new page request to reduce ghost effects [on|off]",
|
||||||
"category": "OBP60 Display",
|
"category": "OBP60 Display",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
|
|
@ -6,9 +6,9 @@ default_envs = obp60_s3
|
||||||
[env:obp60_s3]
|
[env:obp60_s3]
|
||||||
platform = espressif32@6.3.2
|
platform = espressif32@6.3.2
|
||||||
#board = obp60_s3_n8 #8MB flash, no PSRAM
|
#board = obp60_s3_n8 #8MB flash, no PSRAM
|
||||||
board = obp60_s3_n16 #16MB flash, no PSRAM, zero series
|
#board = obp60_s3_n16 #16MB flash, no PSRAM, zero series
|
||||||
#board = obp60_s3_n8r8 #8MB flash, 8MB PSRAM
|
#board = obp60_s3_n8r8 #8MB flash, 8MB PSRAM
|
||||||
#board = obp60_s3_n16r8 #16MB flash, 8MB PSRAM, production series
|
board = obp60_s3_n16r8 #16MB flash, 8MB PSRAM, production series
|
||||||
board_build.variants_dir = variants
|
board_build.variants_dir = variants
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
@ -22,7 +22,8 @@ lib_deps =
|
||||||
blemasle/MCP23017@2.0.0
|
blemasle/MCP23017@2.0.0
|
||||||
adafruit/Adafruit BusIO@1.5.0
|
adafruit/Adafruit BusIO@1.5.0
|
||||||
adafruit/Adafruit GFX Library@1.11.9
|
adafruit/Adafruit GFX Library@1.11.9
|
||||||
zinggjm/GxEPD2@1.5.6
|
#zinggjm/GxEPD2@1.5.6
|
||||||
|
https://github.com/ZinggJM/GxEPD2
|
||||||
sstaub/Ticker@4.4.0
|
sstaub/Ticker@4.4.0
|
||||||
adafruit/Adafruit BMP280 Library@2.6.2
|
adafruit/Adafruit BMP280 Library@2.6.2
|
||||||
adafruit/Adafruit BME280 Library@2.2.2
|
adafruit/Adafruit BME280 Library@2.2.2
|
||||||
|
|
Loading…
Reference in New Issue