comparison Discovery/Src/t7.c @ 138:cc9c18075e00 FlipDisplay

Removed no longer supported scooter code
author Ideenmodellierer
date Sat, 23 Feb 2019 21:10:51 +0100
parents 3834b6272ee5
children d5bbdcb32a14
comparison
equal deleted inserted replaced
137:9eda5a75c5fd 138:cc9c18075e00
27 ////////////////////////////////////////////////////////////////////////////// 27 //////////////////////////////////////////////////////////////////////////////
28 28
29 /* Includes ------------------------------------------------------------------*/ 29 /* Includes ------------------------------------------------------------------*/
30 #include "t7.h" 30 #include "t7.h"
31 31
32 //#include "bonexConnect.h"
33 #include "data_exchange_main.h" 32 #include "data_exchange_main.h"
34 #include "decom.h" 33 #include "decom.h"
35 #include "gfx_fonts.h" 34 #include "gfx_fonts.h"
36 #include "logbook_miniLive.h" 35 #include "logbook_miniLive.h"
37 #include "math.h" 36 #include "math.h"
51 50
52 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide); 51 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide);
53 52
54 void t7_tissues(const SDiveState * pState); 53 void t7_tissues(const SDiveState * pState);
55 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading); 54 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading);
56 void t7_scooter(void);
57 void t7_SummaryOfLeftCorner(void); 55 void t7_SummaryOfLeftCorner(void);
58 void t7_debug(void); 56 void t7_debug(void);
59 57
60 void t7_miniLiveLogProfile(void); 58 void t7_miniLiveLogProfile(void);
61 //void t7_clock(void); 59 //void t7_clock(void);
142 CVIEW_sensors_mV, 140 CVIEW_sensors_mV,
143 CVIEW_END, 141 CVIEW_END,
144 CVIEW_END 142 CVIEW_END
145 }; 143 };
146 144
147 const uint8_t customviewsDiveScooter[] =
148 {
149 CVIEW_Scooter,
150 CVIEW_sensors,
151 CVIEW_Compass,
152 CVIEW_Decolist,
153 CVIEW_Tissues,
154 CVIEW_Profile,
155 CVIEW_Gaslist,
156 CVIEW_sensors_mV,
157 CVIEW_EADTime,
158 CVIEW_SummaryOfLeftCorner,
159 CVIEW_noneOrDebug,
160 CVIEW_END,
161 CVIEW_END
162 };
163
164 const uint8_t customviewsSurfaceScooter[] =
165 {
166 // CVIEW_CompassDebug,
167 CVIEW_Scooter,
168 CVIEW_Hello,
169 CVIEW_sensors,
170 CVIEW_Compass,
171 CVIEW_Tissues,
172 CVIEW_sensors_mV,
173 CVIEW_END,
174 CVIEW_END
175 };
176
177 const uint8_t *customviewsDive = customviewsDiveStandard; 145 const uint8_t *customviewsDive = customviewsDiveStandard;
178 const uint8_t *customviewsSurface = customviewsSurfaceStandard; 146 const uint8_t *customviewsSurface = customviewsSurfaceStandard;
179 147
180 #define TEXTSIZE 16 148 #define TEXTSIZE 16
181 /* offset includes line: 2 = line +1 149 /* offset includes line: 2 = line +1
201 { 169 {
202 170
203 SSettings* pSettings; 171 SSettings* pSettings;
204 pSettings = settingsGetPointer(); 172 pSettings = settingsGetPointer();
205 173
206
207 if(getLicence() == LICENCEBONEX)
208 {
209 customviewsDive = customviewsDiveScooter;
210 customviewsSurface = customviewsSurfaceScooter;
211 }
212
213 selection_custom_field = 1; 174 selection_custom_field = 1;
214 selection_customview = customviewsSurface[0]; 175 selection_customview = customviewsSurface[0];
215 176
216 t7screen.FBStartAdress = 0; 177 t7screen.FBStartAdress = 0;
217 t7screen.ImageHeight = 480; 178 t7screen.ImageHeight = 480;
630 settingsGetPointer()->design = 6; 591 settingsGetPointer()->design = 6;
631 releaseAllFramesExcept(22,t7screen.FBStartAdress); 592 releaseAllFramesExcept(22,t7screen.FBStartAdress);
632 releaseFrame(22,t7screen.FBStartAdress); 593 releaseFrame(22,t7screen.FBStartAdress);
633 return; 594 return;
634 } 595 }
635 else if(DataEX_scooterFoundAndValidLicence()) // new for t9 hw 160711
636 {
637 settingsGetPointer()->design = 9;
638 releaseAllFramesExcept(22,t7screen.FBStartAdress);
639 releaseFrame(22,t7screen.FBStartAdress);
640 return;
641 }
642 else 596 else
643 { 597 {
644 t7_refresh_divemode(); 598 t7_refresh_divemode();
645 } 599 }
646 } 600 }
754 text[0] = '\002'; 708 text[0] = '\002';
755 text[1] = TXT_2BYTE; 709 text[1] = TXT_2BYTE;
756 text[2] = TXT2BYTE_ButtonMenu; 710 text[2] = TXT2BYTE_ButtonMenu;
757 text[3] = 0; 711 text[3] = 0;
758 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen); 712 write_content_simple(&t7screen, 0, 799, 479-TOP_LINE_HIGHT, &FontT24,text,CLUT_ButtonSurfaceScreen);
759
760 /*
761 // scooter connected?
762 if(bC_getData(0,0,0,0) == BC_CONNECTED)
763 {
764 text[0] = '\f';
765 text[1] = '\002';
766 memcpy(&text[2],&settingsGetPointer()->scooterDeviceName,19);
767 text[21] = 0;
768 GFX_write_string_color(&FontT24,&t7r1,text,0,CLUT_NiceGreen);
769 }
770 */
771 713
772 /* was power on reset */ 714 /* was power on reset */
773 //..... 715 //.....
774 /* removed hw 160802 in V1.1.1 716 /* removed hw 160802 in V1.1.1
775 if(errorsInSettings) 717 if(errorsInSettings)
1585 pViews = customviewsDive; 1527 pViews = customviewsDive;
1586 } 1528 }
1587 } 1529 }
1588 } while(cv_disabled); 1530 } while(cv_disabled);
1589 } 1531 }
1590
1591
1592 // if((*pViews == CVIEW_Scooter) && (getLicence() != LICENCEBONEX))
1593 // pViews++;
1594
1595 selection_customview = *pViews; 1532 selection_customview = *pViews;
1596 } 1533 }
1597 1534
1598 1535
1599 uint8_t t7_get_length_of_customtext(void) 1536 uint8_t t7_get_length_of_customtext(void)
1622 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime 1559 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime
1623 1560
1624 SSettings* pSettings; 1561 SSettings* pSettings;
1625 pSettings = settingsGetPointer(); 1562 pSettings = settingsGetPointer();
1626 1563
1627
1628 if((selection_customview == CVIEW_Scooter) && (getLicence() != LICENCEBONEX))
1629 t7_change_customview();
1630 if((selection_customview == CVIEW_Scooter) && (!DataEX_scooterFoundAndValidLicence() && (stateRealGetPointer()->mode == MODE_DIVE)))
1631 t7_change_customview();
1632 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) 1564 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
1633 t7_change_customview(); 1565 t7_change_customview();
1634 if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) 1566 if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0))
1635 t7_change_customview(); 1567 t7_change_customview();
1636 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) 1568 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
1742 ); 1674 );
1743 GFX_write_string(&FontT24,&t7cC,text,0); 1675 GFX_write_string(&FontT24,&t7cC,text,0);
1744 } 1676 }
1745 break; 1677 break;
1746 1678
1747 case CVIEW_Scooter:
1748 snprintf(text,100,"\032\f\001Scooter");
1749 GFX_write_string(&FontT42,&t7cH,text,0);
1750 t7_scooter();
1751 break;
1752
1753 case CVIEW_Gaslist: 1679 case CVIEW_Gaslist:
1754 // a lot of code taken from tMenuGas.c 1680 // a lot of code taken from tMenuGas.c
1755 // header 1681 // header
1756 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist); 1682 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist);
1757 GFX_write_string(&FontT42,&t7cH,text,0); 1683 GFX_write_string(&FontT42,&t7cH,text,0);
3203 text[textpointer++] = 0; 3129 text[textpointer++] = 0;
3204 GFX_write_string(&FontT42, &t7cY0free, text, 1); 3130 GFX_write_string(&FontT42, &t7cY0free, text, 1);
3205 } 3131 }
3206 3132
3207 3133
3208 void t7_scooter(void)
3209 {
3210 float scooterTemperatureLocal;
3211 uint16_t scooterSpeedLocal;
3212 // uint16_t scooterDrehzhl;
3213 uint8_t scooterResidualCapacity;
3214 // float scooterVoltage;
3215 // uint8_t scooterCurrent;
3216 //uint16_t scooterWattHours;
3217 // uint16_t bkpX0, bkpX1;
3218 uint16_t ageInMilliSeconds;
3219
3220 uint8_t textSize;
3221
3222 scooterTemperatureLocal = unit_temperature_float(((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f);
3223 scooterSpeedLocal = unit_speed_integer(stateUsed->lifeData.scooterSpeed);
3224 scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity();
3225
3226 // scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl;
3227 // scooterVoltage = stateUsed->lifeData.scooterSpannung;
3228 // scooterCurrent = stateUsed->lifeData.scooterAmpere;
3229 // scooterWattHours = stateUsed->lifeData.scooterWattstunden;
3230
3231 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds;
3232 if(!ageInMilliSeconds)
3233 ageInMilliSeconds = 9999;
3234
3235 char text[256+60];
3236 uint8_t textpointer = 0;
3237
3238 t7cY0free.WindowLineSpacing = 28 + 48 + 14;
3239 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing;
3240 t7cY0free.WindowNumberOfTextLines = 3;
3241
3242 // header
3243 // text[textpointer++] = '\032';
3244 text[textpointer++] = TXT_2BYTE;
3245 text[textpointer++] = TXT2BYTE_ScooterRestkapazitaet;
3246 text[textpointer++] = '\n';
3247 text[textpointer++] = '\r';
3248 text[textpointer++] = TXT_2BYTE;
3249 text[textpointer++] = TXT2BYTE_ScooterTemperature;
3250 text[textpointer++] = '\n';
3251 text[textpointer++] = '\r';
3252 text[textpointer++] = TXT_2BYTE;
3253 text[textpointer++] = TXT2BYTE_ScooterSpeed;
3254 text[textpointer++] = 0;
3255 GFX_write_string(&FontT24, &t7cY0free, text, 1);
3256
3257 /*
3258 snprintf(text,60,
3259 "\032"
3260 "%0u" "\016\016 Wh used\017"
3261 ,stateUsed->lifeData.scooterWattstunden);
3262 */
3263
3264 GFX_write_string(&FontT24, &t7cY0free, text, 1);
3265
3266 /*
3267 snprintf(text,60,
3268 "\030"
3269 "\n\r"
3270 "\n\r"
3271 "%0u" "\022\016\016 rpm\017\030"
3272 ,stateUsed->lifeData.scooterDrehzahl);
3273 GFX_write_string(&FontT24, &t7cY0free, text, 1);
3274 */
3275 // data
3276 t7cY0free.WindowY0 -= 52;
3277 if(settingsGetPointer()->nonMetricalSystem == 0)
3278 {
3279 textSize = snprintf(text,60,
3280 "\030"
3281 "%0u" "\022\016\016 %%\017\030"
3282 "\n\r"
3283 "%0.0f\140" "\022\016\016 C\017\030"
3284 "\n\r"
3285 "%u" "\022\016\016 m/min\017\030"
3286 ,scooterResidualCapacity,scooterTemperatureLocal,scooterSpeedLocal);
3287 }
3288 else
3289 {
3290 textSize = snprintf(text,60,
3291 "\030"
3292 "%0u" "\022\016\016 %%\017\030"
3293 "\n\r"
3294 "%0.0f\140" "\022\016\016 Fht\017\030"
3295 "\n\r"
3296 "%u" "\022\016\016 ft/min\017\030"
3297 ,scooterResidualCapacity,scooterTemperatureLocal,scooterSpeedLocal);
3298 }
3299 // connection active
3300 if(ageInMilliSeconds > 1500)
3301 {
3302 for(int i=0; i < textSize -2; i++)
3303 {
3304 if(text[i] == '\030')
3305 text[i] = '\031';
3306 }
3307 }
3308 // write data
3309 GFX_write_string(&FontT42, &t7cY0free, text, 1);
3310
3311 // age stamp
3312 if(ageInMilliSeconds < 9999)
3313 {
3314 t7cY0free.WindowY0 -= 30;
3315 snprintf(text,60,
3316 "\021\001%u"
3317 ,ageInMilliSeconds);
3318 GFX_write_string(&FontT24, &t7cY0free, text, 0);
3319 }
3320 }
3321
3322
3323 void t7_scooter_May2016_01(void)
3324 {
3325 float scooterTemperature;
3326 uint16_t scooterDrehzhl;
3327 uint8_t scooterResidualCapacity;
3328 float scooterSpeed;
3329 float scooterVoltage;
3330 uint8_t scooterCurrent;
3331 // uint16_t scooterWattHours;
3332 uint16_t bkpX0, bkpX1;
3333
3334 uint16_t ageInMilliSeconds;
3335 uint8_t textSize;
3336 // old scooterStatus = bC_getData(0,&scooterTemperature,&scooterDrehzhl,&scooterResidualCapacity);
3337
3338 scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl;
3339 scooterTemperature = ((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f;
3340 scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity();
3341
3342 scooterVoltage = stateUsed->lifeData.scooterSpannung;
3343 scooterCurrent = stateUsed->lifeData.scooterAmpere;
3344 // scooterWattHours = stateUsed->lifeData.scooterWattstunden;
3345
3346 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds;
3347
3348 scooterSpeed = scooterDrehzhl * 80 / 3300;
3349
3350 char text[256+60];
3351
3352 t7cY0free.WindowLineSpacing = (28 + 48 + 14)/2;
3353 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 5 * t7cY0free.WindowLineSpacing;
3354 t7cY0free.WindowNumberOfTextLines = 6;
3355
3356 t7cY0free.WindowY0 -= 7;
3357
3358 bkpX0 = t7cY0free.WindowX0;
3359 bkpX1 = t7cY0free.WindowX1;
3360 t7cY0free.WindowX0 = 430;
3361
3362 textSize = snprintf(text,120,
3363 "\022\016\016"
3364 "%%"
3365 "\n\r"
3366 "celsius"
3367 "\n\r"
3368 "rpm"
3369 "\n\r"
3370 "m/min"
3371 "\n\r"
3372 "Ampere"
3373 "\n\r"
3374 "Volt"
3375 // "\n\r"
3376 // "Wh"
3377 );
3378 GFX_write_string(&FontT42, &t7cY0free, text, 1);
3379
3380 t7cY0free.WindowX0 = bkpX0;
3381 t7cY0free.WindowX1 = 420;
3382
3383 textSize = snprintf(text,120,
3384 "\030"
3385 "\002"
3386 "%0u"
3387 "\n\r"
3388 "\002"
3389 "%0.0f"
3390 "\n\r"
3391 "\002"
3392 "%0u"
3393 "\n\r"
3394 "\002"
3395 "%0.0f"
3396 "\n\r"
3397 "\002"
3398 "%0u"
3399 "\n\r"
3400 "\002"
3401 "%0.1f"
3402 // "\n\r"
3403 // "%0u" "\022\016\016 Wh\017\030"
3404 ,scooterResidualCapacity,scooterTemperature,scooterDrehzhl,scooterSpeed
3405 ,scooterCurrent,scooterVoltage);//,scooterWattHours);
3406
3407 if((ageInMilliSeconds > 1500) || (stateUsed->lifeData.scooterType == 0xFF))
3408 {
3409 for(int i=0; i < textSize -2; i++)
3410 {
3411 if(text[i] == '\030')
3412 text[i] = '\031';
3413 }
3414 }
3415 GFX_write_string(&FontT42, &t7cY0free, text, 1);
3416
3417 t7cY0free.WindowX0 = bkpX0;
3418 t7cY0free.WindowX1 = bkpX1;
3419
3420 t7cY0free.WindowY0 -= 30;
3421 snprintf(text,60,
3422 "\021\001%u"
3423 ,ageInMilliSeconds);
3424 GFX_write_string(&FontT24, &t7cY0free, text, 0);
3425
3426 }
3427
3428 void t7_scooter_alt(void)
3429 {
3430 float scooterTemperature;
3431 uint16_t scooterDrehzhl;
3432 uint8_t scooterStatus;
3433 uint8_t scooterResidualCapacity;
3434 float scooterSpeed;
3435 uint16_t ageInMilliSeconds;
3436 uint8_t textSize;
3437 // old scooterStatus = bC_getData(0,&scooterTemperature,&scooterDrehzhl,&scooterResidualCapacity);
3438
3439 scooterStatus = 2;//BC_CONNECTED;
3440 scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl;
3441 scooterTemperature = ((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f;
3442 scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity();
3443 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds;
3444 if(!ageInMilliSeconds)
3445 ageInMilliSeconds = 9999;
3446
3447 scooterSpeed = scooterDrehzhl * 80 / 3300;
3448
3449 char text[256+60];
3450 uint8_t textpointer = 0;
3451
3452 //float percent_N2;
3453 //float percent_He;
3454 //float partial_pressure_N2;
3455 //float partial_pressure_He;
3456
3457 t7cY0free.WindowLineSpacing = 28 + 48 + 14;
3458 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing;
3459 t7cY0free.WindowNumberOfTextLines = 3;
3460
3461 text[textpointer++] = '\032';
3462 text[textpointer++] = TXT_2BYTE;
3463 text[textpointer++] = TXT2BYTE_ScooterRestkapazitaet;
3464 text[textpointer++] = '\n';
3465 text[textpointer++] = '\r';
3466 text[textpointer++] = TXT_2BYTE;
3467 text[textpointer++] = TXT2BYTE_ScooterTemperature;
3468 text[textpointer++] = '\n';
3469 text[textpointer++] = '\r';
3470 text[textpointer++] = TXT_2BYTE;
3471 text[textpointer++] = TXT2BYTE_ScooterSpeed;
3472 text[textpointer++] = 0;
3473
3474 GFX_write_string(&FontT24, &t7cY0free, text, 1);
3475
3476 if(scooterStatus == 2)//BC_CONNECTED)
3477 {
3478 t7cY0free.WindowY0 -= 52;
3479 textSize = snprintf(text,60,
3480 "\030"
3481 "%0u" "\022\016\016 %%\017\030"
3482 "\n\r"
3483 "%0.0f\140" "\022\016\016 celsius\017\030"
3484 "\n\r"
3485 "%0.0f" "\022\016\016 m/min\017\030"
3486 ,scooterResidualCapacity,scooterTemperature,scooterSpeed);
3487
3488 if(ageInMilliSeconds > 1500)
3489 {
3490 for(int i=0; i < textSize -2; i++)
3491 {
3492 if(text[i] == '\030')
3493 text[i] = '\031';
3494 }
3495 }
3496 // snprintf(text,60,"\031%0.2f\n\r%0.2f\n\r%u",scooterWatt,scooterTemperature,scooterDrehzhl);
3497 GFX_write_string(&FontT42, &t7cY0free, text, 1);
3498
3499 t7cY0free.WindowY0 -= 30;
3500 snprintf(text,60,
3501 "\021\001%u"
3502 ,ageInMilliSeconds);
3503 GFX_write_string(&FontT24, &t7cY0free, text, 0);
3504
3505 }
3506 }
3507 3134
3508 3135
3509 /* 3136 /*
3510 point_t start, change, stop; 3137 point_t start, change, stop;
3511 float value; 3138 float value;