Clock with 1 minutes sub tiles an jumping minute pointer
This commit is contained in:
		
							parent
							
								
									fce5c3a937
								
							
						
					
					
						commit
						0196ff8ecd
					
				|  | @ -34,6 +34,9 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ | ||||||
|     static const int bsize = 30; |     static const int bsize = 30; | ||||||
|     char buffer[bsize+1]; |     char buffer[bsize+1]; | ||||||
|     buffer[0]=0; |     buffer[0]=0; | ||||||
|  | 
 | ||||||
|  |     //########################################################
 | ||||||
|  |     // Formats for several boat data
 | ||||||
|     //########################################################
 |     //########################################################
 | ||||||
|     if (value->getFormat() == "formatDate"){ |     if (value->getFormat() == "formatDate"){ | ||||||
|          |          | ||||||
|  | @ -383,7 +386,98 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     //########################################################
 |     //########################################################
 | ||||||
|     else if (value->getFormat() == "formatXdrD"){ |     // Special XDR formats
 | ||||||
|  |     // Refer XDR formats in GwXDRMappings.cpp line 40
 | ||||||
|  |     //########################################################
 | ||||||
|  |     else if (value->getFormat() == "formatXdr:P:P"){ | ||||||
|  |         double pressure = 0; | ||||||
|  |         if(usesimudata == false) { | ||||||
|  |             pressure = value->value; | ||||||
|  |             pressure = pressure / 1000.0;      // Unit conversion form Pa to kPa
 | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             pressure = 96 + float(random(0, 20)) / 10.0; | ||||||
|  |         } | ||||||
|  |         if(pressure <= 99.9){ | ||||||
|  |             snprintf(buffer,bsize,"%3.1f",pressure); | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             snprintf(buffer,bsize,"%3.0f",pressure); | ||||||
|  |         } | ||||||
|  |         result.unit = "kPa"; | ||||||
|  |     } | ||||||
|  |     //########################################################
 | ||||||
|  |     else if (value->getFormat() == "formatXdr:P:B"){ | ||||||
|  |         double pressure = 0; | ||||||
|  |         if(usesimudata == false) { | ||||||
|  |             pressure = value->value; | ||||||
|  |             pressure = pressure / 100.0;      // Unit conversion form Pa to mBar
 | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             pressure = 968 + float(random(0, 10)); | ||||||
|  |         } | ||||||
|  |         snprintf(buffer,bsize,"%4.0f",pressure); | ||||||
|  |         result.unit = "mBar"; | ||||||
|  |     } | ||||||
|  |     //########################################################
 | ||||||
|  |     else if (value->getFormat() == "formatXdr:U:V"){ | ||||||
|  |         double voltage = 0; | ||||||
|  |         if(usesimudata == false) { | ||||||
|  |             voltage = value->value; | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             voltage = 12 + float(random(0, 30)) / 10.0; | ||||||
|  |         } | ||||||
|  |         if(voltage < 10){ | ||||||
|  |             snprintf(buffer,bsize,"%3.2f",voltage); | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             snprintf(buffer,bsize,"%3.1f",voltage); | ||||||
|  |         } | ||||||
|  |         result.unit = "V"; | ||||||
|  |     } | ||||||
|  |     //########################################################
 | ||||||
|  |     else if (value->getFormat() == "formatXdr:I:A"){ | ||||||
|  |         double current = 0; | ||||||
|  |         if(usesimudata == false) { | ||||||
|  |             current = value->value; | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             current = 8.2 + float(random(0, 50)) / 10.0; | ||||||
|  |         } | ||||||
|  |         if(current < 10){ | ||||||
|  |             snprintf(buffer,bsize,"%3.2f",current); | ||||||
|  |         } | ||||||
|  |         if(current >= 10 && current < 100){ | ||||||
|  |             snprintf(buffer,bsize,"%3.1f",current); | ||||||
|  |         } | ||||||
|  |         if(current >= 100){ | ||||||
|  |             snprintf(buffer,bsize,"%3.0f",current); | ||||||
|  |         } | ||||||
|  |         result.unit = "A"; | ||||||
|  |     } | ||||||
|  |     //########################################################
 | ||||||
|  |     else if (value->getFormat() == "formatXdr:C:K"){ | ||||||
|  |         double temperature = 0; | ||||||
|  |         if(usesimudata == false) { | ||||||
|  |             temperature = value->value; | ||||||
|  |         } | ||||||
|  |         else{ | ||||||
|  |             temperature = 21.8 + float(random(0, 50)) / 10.0; | ||||||
|  |         } | ||||||
|  |         if(temperature < 10){ | ||||||
|  |             snprintf(buffer,bsize,"%3.2f",temperature); | ||||||
|  |         } | ||||||
|  |         if(temperature >= 10 && temperature < 100){ | ||||||
|  |             snprintf(buffer,bsize,"%3.1f",temperature); | ||||||
|  |         } | ||||||
|  |         if(temperature >= 100){ | ||||||
|  |             snprintf(buffer,bsize,"%3.0f",temperature); | ||||||
|  |         } | ||||||
|  |         result.unit = "K"; | ||||||
|  |     } | ||||||
|  |     //########################################################
 | ||||||
|  |     else if (value->getFormat() == "formatXdr:A:D"){ | ||||||
|         double angle = 0; |         double angle = 0; | ||||||
|         if(usesimudata == false) { |         if(usesimudata == false) { | ||||||
|             angle = value->value; |             angle = value->value; | ||||||
|  | @ -401,6 +495,8 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){ | ||||||
|         result.unit = "Deg"; |         result.unit = "Deg"; | ||||||
|     } |     } | ||||||
|     //########################################################
 |     //########################################################
 | ||||||
|  |     // Default format
 | ||||||
|  |     //########################################################
 | ||||||
|     else{ |     else{ | ||||||
|         if(value->value < 10){ |         if(value->value < 10){ | ||||||
|             snprintf(buffer,bsize,"%3.2f",value->value); |             snprintf(buffer,bsize,"%3.2f",value->value); | ||||||
|  |  | ||||||
|  | @ -168,7 +168,7 @@ public: | ||||||
|         display.fillCircle(200, 150, rInstrument + 10, pixelcolor);    // Outer circle
 |         display.fillCircle(200, 150, rInstrument + 10, pixelcolor);    // Outer circle
 | ||||||
|         display.fillCircle(200, 150, rInstrument + 7, bgcolor);        // Outer circle     
 |         display.fillCircle(200, 150, rInstrument + 7, bgcolor);        // Outer circle     
 | ||||||
| 
 | 
 | ||||||
|         for(int i=0; i<360; i=i+10) |         for(int i=0; i<360; i=i+1) | ||||||
|         { |         { | ||||||
|             // Scaling values
 |             // Scaling values
 | ||||||
|             float x = 200 + (rInstrument-30)*sin(i/180.0*pi);  //  x-coordinate dots
 |             float x = 200 + (rInstrument-30)*sin(i/180.0*pi);  //  x-coordinate dots
 | ||||||
|  | @ -202,11 +202,15 @@ public: | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // Draw sub scale with dots
 |             // Draw sub scale with dots
 | ||||||
|  |             float sinx = 0; | ||||||
|  |             float cosx = 0; | ||||||
|  |              if(i % 6 == 0){ | ||||||
|                 float x1c = 200 + rInstrument*sin(i/180.0*pi); |                 float x1c = 200 + rInstrument*sin(i/180.0*pi); | ||||||
|                 float y1c = 150 - rInstrument*cos(i/180.0*pi); |                 float y1c = 150 - rInstrument*cos(i/180.0*pi); | ||||||
|                 display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor); |                 display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor); | ||||||
|             float sinx=sin(i/180.0*pi); |                 sinx=sin(i/180.0*pi); | ||||||
|             float cosx=cos(i/180.0*pi);  |                 cosx=cos(i/180.0*pi); | ||||||
|  |              } | ||||||
| 
 | 
 | ||||||
|             // Draw sub scale with lines (two triangles)
 |             // Draw sub scale with lines (two triangles)
 | ||||||
|             if(i % 30 == 0){ |             if(i % 30 == 0){ | ||||||
|  | @ -245,7 +249,8 @@ public: | ||||||
|         if (value1 < 0) {value1 = value1 + 86400;} |         if (value1 < 0) {value1 = value1 + 86400;} | ||||||
|         hour = (value1 / 3600.0); |         hour = (value1 / 3600.0); | ||||||
|         if(hour > 12) hour = hour - 12.0; |         if(hour > 12) hour = hour - 12.0; | ||||||
|         minute = (hour - int(hour)) * 3600.0 / 60.0; | //        minute = (hour - int(hour)) * 3600.0 / 60.0;        // Analog minute pointer smoth moving
 | ||||||
|  |         minute = int((hour - int(hour)) * 3600.0 / 60.0);   // Jumping minute pointer from minute to minute
 | ||||||
|         LOG_DEBUG(GwLog::DEBUG,"... PageClock, value1: %f hour: %f minute:%f", value1, hour, minute); |         LOG_DEBUG(GwLog::DEBUG,"... PageClock, value1: %f hour: %f minute:%f", value1, hour, minute); | ||||||
|          |          | ||||||
|         // Draw hour pointer
 |         // Draw hour pointer
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 norbert-walter
						norbert-walter