diff --git a/.gitignore b/.gitignore index 065e5883..fc8faa02 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ driver/*.sys *.map genuine/ wrkspc.txt +.vscode/* diff --git a/bin/myevic.bin b/bin/myevic.bin index 2f23a446..a6b0aff4 100755 Binary files a/bin/myevic.bin and b/bin/myevic.bin differ diff --git a/inc/dataflash.h b/inc/dataflash.h index aeb650a7..b00969aa 100644 --- a/inc/dataflash.h +++ b/inc/dataflash.h @@ -83,6 +83,7 @@ typedef struct /* 04000000 */ unsigned int chkmodeoff:1; /* 08000000 */ unsigned int dfmt2:1; /* 10000000 */ unsigned int pcurve:1; +/* 20000000 */ unsigned int battvs:1; // Do not exceed 32 bits; // if you may do so, create another bitfield. diff --git a/inc/events.h b/inc/events.h index 09800001..7b3f98ab 100644 --- a/inc/events.h +++ b/inc/events.h @@ -91,6 +91,7 @@ enum CLICK_ACTION_NEXT_MODE, CLICK_ACTION_ON_OFF, CLICK_ACTION_PROFILE, + CLICK_ACTION_GAME, CLICK_ACTION_MAX }; diff --git a/src/eh.c b/src/eh.c index 3c1d89af..2cf3e965 100644 --- a/src/eh.c +++ b/src/eh.c @@ -1253,7 +1253,7 @@ __myevic__ void EventHandler() break; case 4: - if ( ++dfAPT > 8 ) dfAPT = 0; + if ( ++dfAPT > 9 ) dfAPT = 0; break; case 5: @@ -1261,13 +1261,20 @@ __myevic__ void EventHandler() { dfStatus.battpc = 1; dfStatus.battv = 0; + dfStatus.battvs = 0; } - else if ( !dfStatus.battv ) + else if ( dfStatus.battpc && !dfStatus.battv && !dfStatus.battvs ) { dfStatus.battv = 1; } + else if ( dfStatus.battpc && dfStatus.battv && !dfStatus.battvs && NumBatteries >= 2 ) + { + dfStatus.battv = 0; + dfStatus.battvs = 1; + } else { + dfStatus.battvs = 0; dfStatus.battv = 0; dfStatus.battpc = 0; } diff --git a/src/events.c b/src/events.c index 12223009..7b44d262 100644 --- a/src/events.c +++ b/src/events.c @@ -393,6 +393,10 @@ __myevic__ void GetUserInput() case CLICK_ACTION_PROFILE: FireClicksEvent = EVENT_NEXT_PROFILE; // Cycle profile break; + + case CLICK_ACTION_GAME: + FireClicksEvent = 40; // Game + break; } if ( dfStatus.off ) { @@ -1266,6 +1270,10 @@ __myevic__ int CustomEvents() ShowProfNum = 30; break; + case 40: // Game + fbStartGame(); + break; + case EVENT_POWER_CURVE: SetScreen( 107, 30 ); EditModeTimer = 3000; diff --git a/src/mainview.c b/src/mainview.c index d69d831e..849561f1 100644 --- a/src/mainview.c +++ b/src/mainview.c @@ -315,7 +315,15 @@ __myevic__ void DrawAPTLine( int line ) break; } - case 6: // Board temperature + case 6: // Battery percentage + { + DrawString( String_BATT_s, 0, line+2 ); + DrawValue( BatteryPercent>99?30:38, line, BatteryPercent, 0, 0x1F, 0 ); + DrawImage( 55, line+2, 0xC2 ); + break; + } + + case 7: // Board temperature { DrawString( String_BOARD_s, 0, line+2 ); @@ -326,7 +334,7 @@ __myevic__ void DrawAPTLine( int line ) break; } - case 7: // Real-time atomizer resistance + case 8: // Real-time atomizer resistance { int rez = AtoError ? 0 : AtoRezMilli; int nd = ( rez < 1000 ) ? 3 : 4; @@ -338,7 +346,7 @@ __myevic__ void DrawAPTLine( int line ) break; } - case 8: // Real-time clock + case 9: // Real-time clock { S_RTC_TIME_DATA_T rtd; GetRTC( &rtd ); @@ -672,7 +680,7 @@ __myevic__ void ShowMainView() if ( dfMode != 6 ) { DrawHLine( 0, 43, 63, 1 ); - DrawHLine( 0, 107, 63, 1 ); + DrawHLine( 0, 106, 63, 1 ); ShowBattery(); @@ -706,7 +714,9 @@ __myevic__ void ShowMainView() } else { - DrawInfoLines(); + if ( !dfStatus.logomid || dfStatus.logomid && HideLogo ) { + DrawInfoLines(); + } } } @@ -721,7 +731,6 @@ __myevic__ void ShowMainView() DrawFillRect( 0, 52, 63, 70, 0 ); } } - DrawLOGO( 0, 0 ); } } diff --git a/src/menus.c b/src/menus.c index e3eac027..b38f7bbc 100644 --- a/src/menus.c +++ b/src/menus.c @@ -383,6 +383,10 @@ __myevic__ void ClicksMenuIDraw( int it, int line, int sel ) case CLICK_ACTION_PROFILE: DrawString( String_ProfPlus, 20, line+2 ); break; + + case CLICK_ACTION_GAME: + DrawString( String_Game, 20, line+2 ); + break; } } diff --git a/src/screens.c b/src/screens.c index 5cc74f90..6bfbe3f5 100644 --- a/src/screens.c +++ b/src/screens.c @@ -526,12 +526,58 @@ __myevic__ void ShowBattery() if ( dfStatus.battpc ) { - if ( dfStatus.battv ) - { + if ( dfStatus.battv ) { uint16_t bv = gFlags.firing ? RTBattVolts : BatteryVoltage; DrawValueRight( 20, 118, bv, 2, 0x0B, 0 ); DrawImage( 21, 118, 0x7D ); } + else if ( dfStatus.battvs ) + { + switch (NumBatteries) { + case 2: { + if (!gFlags.battery_charging) { + uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0]; + DrawValueRight( 23, 111, bv, 2, 0x15, 0 ); + DrawImage( 24, 117, 0x7D ); + uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1]; + DrawValueRight( 58, 111, bv2, 2, 0x15, 0 ); + DrawImage( 59, 117, 0x7D ); + } + break; + } + case 3: { + if (!gFlags.battery_charging) { + uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0]; + DrawValueRight( 20, 109, bv, 2, 0x0B, 0 ); + DrawImage( 21, 109, 0x7D ); + uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1]; + DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 ); + DrawImage( 58, 109, 0x7D ); + uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2]; + DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 ); + DrawImage( 40, 120, 0x7D ); + } + break; + } + case 4: { + if (!gFlags.battery_charging) { + uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0]; + DrawValueRight( 20, 109, bv, 2, 0x0B, 0 ); + DrawImage( 21, 109, 0x7D ); + uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1]; + DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 ); + DrawImage( 58, 109, 0x7D ); + uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2]; + DrawValueRight( 20, 120, bv3, 2, 0x0B, 0 ); + DrawImage( 21, 120, 0x7D ); + uint16_t bv4 = gFlags.firing ? RTBVolts[4] : BattVolts[4]; + DrawValueRight( 57, 120, bv4, 2, 0x0B, 0 ); + DrawImage( 58, 120, 0x7D ); + } + break; + } + } + } else { DrawValueRight( 18, 118, BatteryPercent, 0, 0x0B, 0 ); @@ -539,17 +585,19 @@ __myevic__ void ShowBattery() } } - if ( gFlags.battery_10pc && !gFlags.battery_charging ) + if ( gFlags.battery_10pc && !gFlags.battery_charging) // full battery bar { if ( gFlags.draw_battery ) { - if ( dfStatus.battpc ) - { - DrawImage( 30, 114, 0xE2 ); - } - else - { - DrawImage( 8, 115, 0xC4 ); + if ( NumBatteries == 1 || !dfStatus.battvs && NumBatteries > 1 ) { + if ( dfStatus.battpc ) + { + DrawImage( 30, 114, 0xE2 ); + } + else + { + DrawImage( 8, 115, 0xC4 ); + } } } } @@ -557,14 +605,56 @@ __myevic__ void ShowBattery() { if ( dfStatus.battpc ) { - DrawImage( 30, 114, 0xE3 ); + if (dfStatus.battvs && NumBatteries >= 2) { + switch (NumBatteries) { + case 2: { + uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0]; + DrawValueRight( 23, 111, bv, 2, 0x15, 0 ); + DrawImage( 24, 117, 0x7D ); + uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1]; + DrawValueRight( 58, 111, bv2, 2, 0x15, 0 ); + DrawImage( 59, 117, 0x7D ); + break; + } + case 3: { + uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0]; + DrawValueRight( 20, 109, bv, 2, 0x0B, 0 ); + DrawImage( 21, 109, 0x7D ); + uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1]; + DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 ); + DrawImage( 58, 109, 0x7D ); + uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2]; + DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 ); + DrawImage( 40, 120, 0x7D ); + break; + } + case 4: { + uint16_t bv = gFlags.firing ? RTBVolts[0] : BattVolts[0]; + DrawValueRight( 20, 109, bv, 2, 0x0B, 0 ); + DrawImage( 21, 109, 0x7D ); + uint16_t bv2 = gFlags.firing ? RTBVolts[1] : BattVolts[1]; + DrawValueRight( 57, 109, bv2, 2, 0x0B, 0 ); + DrawImage( 58, 109, 0x7D ); + uint16_t bv3 = gFlags.firing ? RTBVolts[2] : BattVolts[2]; + DrawValueRight( 39, 120, bv3, 2, 0x0B, 0 ); + DrawImage( 40, 120, 0x7D ); + uint16_t bv4 = gFlags.firing ? RTBVolts[4] : BattVolts[4]; + DrawValueRight( 57, 120, bv4, 2, 0x0B, 0 ); + DrawImage( 58, 120, 0x7D ); + break; + } + } + } + else { + DrawImage( 30, 114, 0xE3 ); + } } else { DrawImage( 8, 115, 0xC5 ); } } - else + else if ( NumBatteries == 1 || !dfStatus.battvs && NumBatteries > 1 ) // idle show battery bar { if ( dfStatus.battpc ) {