Skip to content

bug day #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 63 additions & 59 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,59 +1,63 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
bin/
!bin/myevic.bin
*.sh
disasm/
obj/
projects/
*.o
startfiles
driver/*.sys
*.map
genuine/
wrkspc.txt
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
bin/
!bin/myevic.bin
*.sh
disasm/
obj/
projects/
*.o
startfiles
driver/*.sys
*.map
genuine/
wrkspc.txt
!/bin/
/bin/myevic.elf
/bin/myevic_dec.bin
/nbproject/
Empty file modified ISSUE_TEMPLATE.md
100755 → 100644
Empty file.
Empty file modified LICENSE.txt
100755 → 100644
Empty file.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -47,6 +47,8 @@ MYEVIC_OBJS := src/myevic.o \
src/storage.o \
src/flappy.o \
src/fbdata.o \
src/tetris.o \
src/ttdata.o \
src/fonts.o \
src/display.o \
src/SSD1306.o \
@@ -193,6 +195,9 @@ $(TARGET)_dec.bin: $(OBJS_FIXPATH) $(MYEVIC_OBJS)
$(LD) --start-group $(LIBS) $(OBJS_FIXPATH) $(MYEVIC_OBJS) --end-group $(LDFLAGS) -o $(OUTDIR)/$(TARGET).elf
$(OBJCOPY) -O binary -j .text -j .data $(OUTDIR)/$(TARGET).elf $(OUTDIR)/$(TARGET)_dec.bin

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

$(TARGET).bin: $(TARGET)_dec.bin
evic convert $(OUTDIR)/$(TARGET)_dec.bin -o $(OUTDIR)/$(TARGET).bin

Empty file modified README_pt_BR.docx
100755 → 100644
Empty file.
Binary file modified bin/myevic.bin
100755 → 100644
Binary file not shown.
4 changes: 4 additions & 0 deletions inc/dataflash.h
Original file line number Diff line number Diff line change
@@ -183,6 +183,8 @@ typedef struct dfParams
/* 00E0 */ uint16_t Millis;
/* 00E2 */ uint8_t Profile;
/* 00E3 */ int8_t BVOffset[4];
/* 00E7 */ uint16_t TTBest;
/* 00E9 */ uint8_t TTSpeed;
}
dfParams_t;

@@ -349,6 +351,8 @@ extern dfStruct_t DataFlash;
#define dfSavedCfgPwr DFP(SavedCfgPwr)
#define dfFBBest DFP(FBBest)
#define dfFBSpeed DFP(FBSpeed)
#define dfTTBest DFP(TTBest)
#define dfTTSpeed DFP(TTSpeed)
#define dfBattPC DFP(BattPC)
#define dfContrast DFP(Contrast)
#define dfModesSel DFP(ModesSel)
4 changes: 2 additions & 2 deletions inc/display.h
Original file line number Diff line number Diff line change
@@ -33,8 +33,8 @@ extern const image_t **Images;

extern const image_t const *font0_1306[];
extern const image_t const *font0_1327[];
extern const image_t const *font1_1306[];
extern const image_t const *font1_1327[];
//extern const image_t const *font1_1306[];
//extern const image_t const *font1_1327[];

//-------------------------------------------------------------------------

3 changes: 3 additions & 0 deletions inc/events.h
Original file line number Diff line number Diff line change
@@ -78,6 +78,7 @@ extern uint8_t LastEvent;
#define EVENT_PROFILE_MENU 118
#define EVENT_NEXT_PROFILE 119
#define EVENT_POWER_CURVE 120
#define EVENT_TETRIS 121


//==============================================================================
@@ -91,6 +92,8 @@ enum
CLICK_ACTION_NEXT_MODE,
CLICK_ACTION_ON_OFF,
CLICK_ACTION_PROFILE,
CLICK_ACTION_TETRIS,
CLICK_ACTION_GAME,
CLICK_ACTION_MAX
};

1 change: 1 addition & 0 deletions inc/myevic.h
Original file line number Diff line number Diff line change
@@ -148,6 +148,7 @@ typedef struct
/* 00200000 */ int fading:1;
/* 00400000 */ int led_on:1;
/* 00800000 */ int splash:1;
/* 01000000 */ int playing_tt:1;
}

gFlags_t;
10 changes: 10 additions & 0 deletions inc/screens.h
Original file line number Diff line number Diff line change
@@ -119,6 +119,7 @@ extern const uint8_t String_Right[];
extern const uint8_t String_Left[];
extern const uint8_t String_Logo[];
extern const uint8_t String_Game[];
extern const uint8_t String_Tetris[];
extern const uint8_t String_Easy[];
extern const uint8_t String_Normal[];
extern const uint8_t String_Hard[];
@@ -299,6 +300,15 @@ extern const uint8_t String_Enable[];
extern const uint8_t String_Reset[];
extern const uint8_t String_Splash[];

//from display.c
extern const uint8_t String_Sunday[];
extern const uint8_t String_Monday[];
extern const uint8_t String_Tuesday[];
extern const uint8_t String_Wednesday[];
extern const uint8_t String_Thursday[];
extern const uint8_t String_Friday[];
extern const uint8_t String_Saturday[];
extern const uint8_t String_Survival[];

//==============================================================================

12 changes: 12 additions & 0 deletions inc/tetris.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef __TETRIS_H__
#define __TETRIS_H__

extern void ttInitTimeouts();
extern void ttSetTimeoutDelay( int );
extern void ttTickTimeouts();
extern void ttCallTimeouts();
extern void ttGame();
extern void ttStartGame();

#endif /* __TETRIS_H__ */

1 change: 1 addition & 0 deletions src/dataflash.c
Original file line number Diff line number Diff line change
@@ -467,6 +467,7 @@ __myevic__ void ResetDataFlash()
// dfFBBest = 0;
// dfFBSpeed = 0;
// dfBattPC = 0;
dfTTBest = 0;
dfContrast = 45;
// dfModesSel = 0;
dfClkRatio = RTC_DEF_CLK_RATIO;
36 changes: 32 additions & 4 deletions src/display.c
Original file line number Diff line number Diff line change
@@ -159,9 +159,9 @@ typedef struct
uint8_t sep2offset;
}
datefmt_t;

__myevic__ void DrawDate( int x, int y, S_RTC_TIME_DATA_T *rtd, int colors )
{
{
const datefmt_t format[] =
{
{ 0xC1, 0, 16, 32, 12, 28 },
@@ -179,6 +179,32 @@ __myevic__ void DrawDate( int x, int y, S_RTC_TIME_DATA_T *rtd, int colors )
if (colors&0x01) DrawValue( x + f->yearoffset, y, rtd->u32Year, 0, 0x0B, 4 );
if (colors&0x08) DrawImage( x + f->sep1offset, y, f->separator );
if (colors&0x02) DrawImage( x + f->sep2offset, y, f->separator );

y += 13;
switch ( rtd->u32DayOfWeek )
{
case 0:
DrawStringCentered( String_Sunday, y );
break;
case 1:
DrawStringCentered( String_Monday, y );
break;
case 2:
DrawStringCentered( String_Tuesday, y );
break;
case 3:
DrawStringCentered( String_Wednesday, y );
break;
case 4:
DrawStringCentered( String_Thursday, y );
break;
case 5:
DrawStringCentered( String_Friday, y );
break;
case 6:
DrawStringCentered( String_Saturday, y );
break;
}
}


@@ -668,13 +694,15 @@ __myevic__ void Screen2Bitmap( uint8_t *pu8Bitmap )
//-------------------------------------------------------------------------
__myevic__ void DisplaySetFont()
{
if ( dfStatus.font )
{
//if ( dfStatus.font )
//{
Images = font0_1306;
/*
}
else
{
Images = font1_1306;
}
*/
}

1 change: 1 addition & 0 deletions src/eh.c
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
#include "meadc.h"
#include "atomizer.h"
#include "flappy.h"
#include "tetris.h"

//=========================================================================
// Globals
40 changes: 37 additions & 3 deletions src/events.c
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
#include "atomizer.h"
#include "battery.h"
#include "flappy.h"
#include "tetris.h"
#include "timers.h"
#include "meusbd.h"

@@ -393,6 +394,14 @@ __myevic__ void GetUserInput()
case CLICK_ACTION_PROFILE:
FireClicksEvent = EVENT_NEXT_PROFILE; // Cycle profile
break;

case CLICK_ACTION_TETRIS:
FireClicksEvent = EVENT_TETRIS; // tetris
break;

case CLICK_ACTION_GAME:
FireClicksEvent = 41; // Game
break;
}
if ( dfStatus.off )
{
@@ -483,17 +492,28 @@ __myevic__ void GetUserInput()
}
else if ( !dfStatus.off )
{
if ( !gFlags.playing_fb )
if ( !gFlags.playing_fb && !gFlags.playing_tt)
{
Event = EVENT_ENTER_MENUS;
}
else
{
if ( gFlags.playing_fb)
{
gFlags.playing_fb = 0;
Event = 0;
fbInitTimeouts();
MainView();
}
}
if ( gFlags.playing_tt)
{
gFlags.playing_tt = 0;
Event = 0;
ttInitTimeouts();
MainView();
}

}
}
}
}
@@ -1269,7 +1289,21 @@ __myevic__ int CustomEvents()
EditModeTimer = 3000;
EditItemIndex = 0;
break;


case 40:
SetScreen( 107, 30 );
EditModeTimer = 3000;
EditItemIndex = 0;
break;

case 41:
fbStartGame();
break;

case EVENT_TETRIS:
ttStartGame();
break;

default:
vret = 0;
break;
446 changes: 238 additions & 208 deletions src/fbdata.c

Large diffs are not rendered by default.

33 changes: 23 additions & 10 deletions src/flappy.c
Original file line number Diff line number Diff line change
@@ -47,8 +47,8 @@ extern const uint8_t fbBird0[];
extern const uint8_t fbBird1[];
extern const uint8_t fbBird2[];
extern const uint8_t fbBirdDead[];
extern const uint8_t fbFont[95][16];

extern const uint8_t fbFont[16][16];
extern const uint8_t fbFontDigit[10][16];
//-------------------------------------------------------------------------

#define FB_NUM_TIMERS 3
@@ -244,11 +244,15 @@ __myevic__ void fbDrawSprite( int x, int y, int w, int h, const uint8_t bitmap[]

//=========================================================================
//----- (00007F9C) --------------------------------------------------------
__myevic__ void fbDrawChar( int x, int y, const char c )
__myevic__ void fbDrawChar( int x, int y, const uint8_t c )
{
fbDrawSprite( x, y, 8, 16, fbFont[c-32] );
fbDrawSprite( x, y, 8, 16, fbFont[c] );
}

__myevic__ void fbDrawDigit( int x, int y, const uint8_t c )
{
fbDrawSprite( x, y, 8, 16, fbFontDigit[c] );
}

//=========================================================================
//----- (00007FB8) --------------------------------------------------------
@@ -281,15 +285,15 @@ __myevic__ void fbDrawNumber( int x, int y, int nd, int v )
break;
}

fbDrawChar( x, y, '0' + d );
fbDrawDigit( x, y, d );
x += 8;
}
}


//=========================================================================
//----- (0000803E) --------------------------------------------------------
__myevic__ void fbDrawText( int x, int y, const char *s )
__myevic__ void fbDrawText( int x, int y, const uint8_t *s )
{
for ( ; *s ; ++s )
{
@@ -486,8 +490,13 @@ __myevic__ void fbDeathScreen()
fbDrawColumn( &fbColumn3 );
fbDrawRect( 26, 16, 98, 52, 0, 1 );
fbDrawRect( 26, 16, 98, 52, 1, 0 );
fbDrawText( 27, 18, "SCORE" );
fbDrawText( 27, 36, "BEST" );
//fbDrawText( 27, 18, "SCORE" );
//fbDrawText( 27, 36, "BEST" );
const uint8_t Str_BS [] = { 2, 5, 12, 13, 0 };
const uint8_t Str_SC [] = { 12, 3, 9, 11, 5, 0 };
fbDrawText( 27, 18, Str_SC );
fbDrawText( 27, 36, Str_BS );

fbDrawNumber( 71, 18, fbNumDigits( fbScore ), fbScore );
fbDrawNumber( 71, 36, fbNumDigits( dfFBBest ), dfFBBest );
DisplayRefresh();
@@ -658,7 +667,10 @@ __myevic__ void fbStartScreen()
fbAnimStep = 1;
}
fbSetBirdColumn( 100 );
fbDrawText( 10, fbBirdLine + 16, "Flappy Bird" );
//fbDrawText( 10, fbBirdLine + 16, "FLAPPY BIRD" );
const uint8_t Str_FB [] = { 6, 8, 1, 10, 10, 14, 15, 2, 7, 11, 4, 0 };
fbDrawText( 10, fbBirdLine + 16, Str_FB );

fbBirdAnim( fbBirdLine + 16 );
DisplayRefresh();
fbCLSBuf();
@@ -698,7 +710,8 @@ __myevic__ void fbStartGame()
fbInitTimeouts();
ClearScreenBuffer();
DisplayRefresh();
fbBirdAnim( 24 );
fbAnimStep = 0;
//fbBirdAnim( 24 );
fbCreateTimeout( fbStartScreen + 1 );
}
}
7 changes: 4 additions & 3 deletions src/fonts.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "display.h"

#define __block1__ __attribute__((section (".imgblock1")))
#define __block2__ __attribute__((section (".imgblock2")))
//#define __block2__ __attribute__((section (".imgblock2")))

const image_t f0img1306_0001 = { 6, 8, { 62, 127, 65, 127, 62, 0 } };
const image_t f0img1306_0002 = { 6, 8, { 0, 2, 127, 127, 0, 0 } };
@@ -223,8 +223,7 @@ const image_t f0img1306_00FB = { 22, 24, { 112, 216, 140, 140, 216, 112, 0, 0, 0
const image_t f0img1306_00FC = { 6, 8, { 0, 8, 8, 62, 8, 8 } };
const image_t f0img1306_00FD = { 6, 8, { 0, 8, 8, 8, 8, 8 } };
const image_t f0img1306_00FE = { 64, 64, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 224, 128, 0, 0, 0, 0, 0, 0, 0, 2, 204, 48, 48, 204, 2, 0, 0, 2, 254, 2, 254, 2, 0, 0, 0, 0, 0, 0, 0, 128, 224, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };

const image_t f0img1306_00FF = {64,128,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,16,64,96,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,96,0,0,0,3,0,128,32,0,0,0,0,0,0,0,32,64,64,128,128,0,0,0,0,64,0,160,0,0,0,0,136,0,64,0,0,0,8,0,18,0,0,48,0,0,0,1,2,4,16,32,0,1,0,0,18,240,0,0,0,132,133,0,0,0,128,1,0,4,0,0,0,0,0,0,0,0,0,16,0,34,64,64,0,1,2,36,0,0,160,7,2,0,1,1,0,0,64,64,0,129,128,0,0,0,0,0,192,0,0,1,2,4,64,14,0,12,24,128,96,145,6,48,0,192,32,24,4,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,8,80,18,33,32,65,64,80,96,119,132,128,4,16,0,0,0,32,0,0,13,19,1,0,8,0,64,0,0,72,26,32,96,192,128,0,0,127,0,128,0,19,94,115,48,0,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,4,16,32,64,2,4,226,17,192,32,34,0,0,0,0,1,6,6,0,72,80,32,64,128,0,96,0,96,48,0,0,0,128,0,0,0,0,2,1,31,1,1,128,224,30,0,1,255,0,192,32,24,4,2,0,0,0,0,128,0,64,64,32,32,2,3,1,0,82,18,4,70,7,4,8,136,80,48,48,80,72,72,132,132,0,0,8,9,95,24,48,32,32,32,34,34,53,48,48,16,16,16,58,252,132,66,227,113,49,11,6,7,75,0,16,16,8,0,4,2,2,1,0,0,0,0,0,0,0,0,0,0,128,2,0,4,32,1,1,128,64,96,48,48,24,12,6,131,77,33,30,52,100,128,0,32,32,32,32,160,160,96,113,26,136,198,98,89,53,255,223,4,130,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,10,8,12,12,32,48,8,14,24,18,16,0,0,0,32,4,4,0,16,0,0,0,0,1,10,236,57,56,230,129,192,224,127,51,49,24,24,12,14,7,7,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,128,128,128,128,128,32,32,16,144,144,0,9,136,132,19,224,248,62,31,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,192,192,192,192,224,0,0,0,0,0,0,0,0,0,0,128,192,64,32,144,16,8,4,2,34,33,33,65,1,128,0,64,64,65,65,65,65,1,193,65,65,193,97,67,103,46,60,56,112,224,224,192,128,0,0,0,0,0,0,0,0,0,0,7,255,255,255,255,255,252,248,240,224,128,0,0,0,0,0,2,0,0,32,0,0,16,64,33,17,141,70,34,20,72,41,2,8,12,40,0,1,129,0,0,6,0,2,0,0,128,128,128,128,128,129,129,131,135,14,28,56,112,112,224,192,128,0,240,249,255,255,255,255,255,255,255,255,15,0,0,0,0,0,56,0,0,4,76,0,32,32,0,1,0,128,224,0,16,8,0,4,0,2,2,1,1,1,49,9,5,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,15,15,31,31,255,255,127,127,255,231,224,224,192,192,192,224,0,0,1,0,2,3,2,2,20,12,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,71,127,60,0,0,0,1,1,1,3,3,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
const image_t const *font0_1306[] __block1__ =
{
&f0img1306_0001,
@@ -484,6 +483,7 @@ const image_t const *font0_1306[] __block1__ =
&f0img1306_00FF
};

/*
const image_t f1img1306_0001 = { 6, 8, { 0, 62, 65, 65, 62, 0 } };
const image_t f1img1306_0002 = { 6, 8, { 0, 0, 0, 54, 0, 0 } };
const image_t f1img1306_0003 = { 6, 8, { 0, 48, 73, 73, 6, 0 } };
@@ -923,5 +923,6 @@ const image_t const *font1_1306[] __block1__ =
&f1img1306_00FE,
&f0img1306_00FF
};
*/


30 changes: 27 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
#include "meusbd.h"
#include "miscs.h"
#include "flappy.h"
#include "tetris.h"


//=========================================================================
@@ -830,9 +831,32 @@ __myevic__ void Main()
gFlags.tick_100hz = 0;
ResetWatchDog();
TimedItems();
SleepIfIdle();
//SleepIfIdle();
GetUserInput();
if ( !PE0 )
//if ( !PE0 )
// SleepTimer = 3000;
}
if ( gFlags.tick_10hz )
{
// 10Hz
gFlags.tick_10hz = 0;
DataFlashUpdateTick();
}
}

while ( gFlags.playing_tt )
{
// Tetris game loop
ttCallTimeouts();
if ( gFlags.tick_100hz )
{
// 100Hz
gFlags.tick_100hz = 0;
ResetWatchDog();
TimedItems();
//SleepIfIdle();
GetUserInput();
//if ( !PE0 )
SleepTimer = 3000;
}
if ( gFlags.tick_10hz )
@@ -842,7 +866,7 @@ __myevic__ void Main()
DataFlashUpdateTick();
}
}

if ( gFlags.firing )
{
ReadAtoCurrent();
63 changes: 33 additions & 30 deletions src/mainview.c
Original file line number Diff line number Diff line change
@@ -53,25 +53,25 @@ __myevic__ void DrawMode()
switch ( dfMode )
{
case 0:
DrawString( String_TEMP, 0, 2 );
DrawString( String_TEMP, 10, 0 );
break;
case 1:
DrawString( String_TEMP, 0, 2 );
DrawString( String_TEMP, 10, 0 );
break;
case 2:
DrawString( String_TEMP, 0, 2 );
DrawString( String_TEMP, 10, 0 );
break;
case 3:
DrawString( String_TCR, 0, 2 );
DrawString( String_TCR, 1, 0 );
break;
case 4:
DrawString( String_POWER, 0, 2 );
DrawStringCentered( String_POWER, 0 );
break;
case 5:
DrawString( String_BYPASS, 0, 2 );
DrawStringCentered( String_BYPASS, 0 );
break;
case 6:
DrawString( String_SMART, 13, 4 );
DrawStringCentered( String_SMART, 0 );
break;
default:
break;
@@ -83,21 +83,21 @@ __myevic__ void DrawMode()
switch ( dfMode )
{
case 0:
DrawString( String_NI, 32, 2 );
DrawString( String_NI, 42, 0 );
break;
case 1:
DrawString( String_TI, 32, 2 );
DrawString( String_TI, 42, 0 );
break;
case 2:
DrawString( String_SS, 32, 2 );
DrawImage( 48, 3, 0x04 );
DrawImage( 54, 3, 0x02 );
DrawImage( 59, 3, 0x07 );
DrawString( String_SS, 42 , 0 );
//DrawImage( 48, 3, 0x04 );
//DrawImage( 54, 3, 0x02 );
//DrawImage( 59, 3, 0x07 );
break;
case 3:
DrawValue( 25, 2, dfTCRM[dfTCRIndex], 0, 0x0B, 3 );
DrawImage( 49, 2, 0xA8 );
DrawValue( 57, 2, dfTCRIndex + 1, 0, 0x0B, 1 );
DrawValue( 26, 0, dfTCRM[dfTCRIndex], 0, 0x0B, 3 );
DrawImage( 49, 0, 0xA8 );
DrawValue( 57, 0, dfTCRIndex + 1, 0, 0x0B, 1 );
break;
default:
break;
@@ -490,7 +490,7 @@ __myevic__ void DrawPower( int pwr )
yp = 13;

DrawValue( 5, 13, pwr, 1, 0x48, 2 );
DrawImage( 45, 18, 0xB9 );
DrawImage( 46, 19, 0xB9 );
}
else
{
@@ -507,7 +507,7 @@ __myevic__ void DrawPower( int pwr )
// DrawValue( 0, 18, pwr, 1, 0x29, 4 );
}

DrawImage( 54, 26, 0x98 );
DrawImage( 54, 27, 0x98 );
}

if ( ISMODEVW(dfMode) )
@@ -687,34 +687,37 @@ __myevic__ void ShowMainView()
anim3d( 1 );
}
else if ( dfStatus.clock )
{
{
if ( dfStatus.digclk )
{
DrawDigitClock( 63 );
DrawDigitClock( 58 );
}
else
{
DrawFillRect( 0, 44, 63, 127, 0 );
DrawClock( 54 );
{
DrawFillRect( 0, 44, 63, 127, 0 );
DrawClock( 54 );
}
}
else
{
DrawInfoLines();
}
}
if ( !dfStatus.logomid || (dfStatus.logomid && HideLogo) ) DrawInfoLines();
}
}

if (( Screen == 1 ) && ( !HideLogo ))
{
int h = GetLogoHeight();

if ( h > 0 )
{
if (dfStatus.clock) DrawFillRect( 0, 48, 63, 106, 0 );
if ( h > 40 )
{
DrawFillRect( 0, 48, 63, h, 0 );
}
DrawLOGO( 0, dfStatus.logomid ? 46 : 0 );
{

DrawLOGO( 0, dfStatus.logomid ? 50 : 0 );
} else {
DrawLOGO( 0, dfStatus.logomid ? 56 : 0 );
}
}
}
}
2 changes: 1 addition & 1 deletion src/megpio.c
Original file line number Diff line number Diff line change
@@ -143,7 +143,7 @@ __myevic__ void InitGPIO()
}
else if ( ISRX300 )
{
SYS->GPF_MFPL &= ~(SYS_GPF_MFPL_PF5MFP_Msk|SYS_GPF_MFPL_PF5MFP_Msk);
SYS->GPF_MFPL &= ~(SYS_GPF_MFPL_PF5MFP_Msk|SYS_GPF_MFPL_PF6MFP_Msk);
SYS->GPF_MFPL |= SYS_GPF_MFPL_PF5MFP_GPIO|SYS_GPF_MFPL_PF6MFP_GPIO;
PF5 = 0;
GPIO_SetMode( PF, GPIO_PIN_PIN5_Msk, GPIO_MODE_OUTPUT );
73 changes: 58 additions & 15 deletions src/menus.c
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
#include "dataflash.h"
#include "miscs.h"
#include "flappy.h"
#include "tetris.h"
#include "meusbd.h"
#include "atomizer.h"
#include "battery.h"
@@ -364,6 +365,14 @@ __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;

case CLICK_ACTION_TETRIS:
DrawString( String_Tetris, 20, line+2 );
break;
}
}

@@ -461,15 +470,15 @@ __myevic__ void IFMenuIDraw( int it, int line, int sel )
DrawString( dfStatus.wakeonpm ? String_On : String_Off, 44, line+2 );
break;

case 3: // Font
DrawImage( 44, line+2, dfStatus.font ? 0x9D : 0x9C );
break;
//case 3: // Font
// DrawImage( 44, line+2, dfStatus.font ? 0x9D : 0x9C );
// break;

case 4: // Temp
case 3: // Temp
DrawImage( 44, line+2, dfIsCelsius ? 0xC9 : 0xC8 );
break;

case 5: // TDom
case 4: // TDom
DrawString( dfStatus.priopwr ? String_On : String_Off, 44, line+2 );
break;

@@ -508,12 +517,12 @@ __myevic__ void IFMenuOnClick()
dfStatus.wakeonpm ^= 1;
break;

case 3: // Font
dfStatus.font ^= 1;
DisplaySetFont();
break;
//case 3: // Font
// dfStatus.font ^= 1;
// DisplaySetFont();
// break;

case 4: // Temp
case 3: // Temp
dfIsCelsius ^= 1;
if ( dfIsCelsius )
{
@@ -532,7 +541,7 @@ __myevic__ void IFMenuOnClick()
}
break;

case 5: // TDom
case 4: // TDom
dfStatus.priopwr ^= 1;
break;

@@ -659,6 +668,7 @@ __myevic__ int PreheatMEvent( int event )
if ( dfPreheatPwr > MaxPower ) dfPreheatPwr = MaxPower;
if ( dfPreheatPwr < 10 ) dfPreheatPwr = 10;
}
gFlags.edit_value = 1;
}
gFlags.edit_value ^= 1;
UpdateDFTimer = 50;
@@ -1133,6 +1143,22 @@ __myevic__ void GameIClick()
fbStartGame();
}

__myevic__ void GameTtMEnter()
{
CurrentMenuItem = dfTTSpeed;
}

__myevic__ void GameTtISelect()
{
dfTTSpeed = CurrentMenuItem;
UpdateDFTimer = 50;
}

__myevic__ void GameTtIClick()
{
ttStartGame();
}

//-----------------------------------------------------------------------------

__myevic__ void ModesMEnter()
@@ -1489,7 +1515,23 @@ const menu_t GameMenu =
{ String_Back, 0, EVENT_PARENT_MENU, 0 }
}
};

const menu_t GameTtMenu =
{
String_Tetris,
&MiscsMenu,
GameTtMEnter+1,
0,
GameTtISelect+1,
GameTtIClick+1,
0,
4,
{
{ String_Easy, 0, 0, 0 },
{ String_Normal, 0, 0, 0 },
{ String_Survival, 0, 0, 0 },
{ String_Back, 0, EVENT_PARENT_MENU, 0 }
}
};
const menu_t ModesMenu =
{
String_Modes,
@@ -1795,9 +1837,10 @@ const menu_t MiscsMenu =
0,
0,
0,
4,
5,
{
{ String_Game, &GameMenu, 0, MACTION_SUBMENU },
{ String_Tetris, &GameTtMenu, 0, MACTION_SUBMENU },
{ String_Led, &LedMenu, 0, MACTION_SUBMENU },
{ String_3D, &Object3DMenu, 0, MACTION_SUBMENU },
{ String_Back, 0, EVENT_PARENT_MENU, 0 }
@@ -2063,12 +2106,12 @@ const menu_t IFMenu =
0,
IFMenuOnClick+1,
0,
8,
7,
{
{ String_1Watt, 0, 0, 0 },
{ String_1C5F, 0, 0, 0 },
{ String_WakeMP, 0, 0, 0 },
{ String_Font, 0, 0, 0 },
// { String_Font, 0, 0, 0 },
{ String_Temp, 0, 0, 0 },
{ String_PPwr, 0, 0, 0 },
{ String_Clicks, &ClicksMenu, 0, MACTION_SUBMENU },
4 changes: 2 additions & 2 deletions src/myrtc.c
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ __myevic__ time_t time_to_epoch ( const struct tm *ltm, int utcdiff )

tyears = ltm->tm_year - 70 ; // tm->tm_year is from 1900.
leaps = (tyears + 2) / 4; // no of next two lines until year 2100.
//i = (ltm->tm_year 100) / 100;
//i = (ltm->tm_year 100) / 100;
//leaps -= ( (i/4)*3 + i%4 );
tdays = 0;
for (i=0; i < ltm->tm_mon; i++) tdays += mon_days[i];
@@ -123,7 +123,7 @@ __myevic__ void RTCTimeToEpoch( time_t *t, const S_RTC_TIME_DATA_T *d )
s.tm_min = d->u32Minute;
s.tm_sec = d->u32Second;
s.tm_yday = 0;
s.tm_wday = 0;
s.tm_wday = d->u32DayOfWeek;
s.tm_isdst = 0;

*t = time_to_epoch( &s, 0 );
12 changes: 11 additions & 1 deletion src/strings.c
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ __string__ String_Right [] = { 0xAD, 0x8A, 0x88, 0x89, 0x95, 0 }; // "Right"
__string__ String_Left [] = { 0xA7, 0x86, 0x87, 0x95, 0 }; // "Left"
__string__ String_Logo [] = { 0xA7, 0x90, 0x88, 0x90, 0 }; // "Logo"
__string__ String_Game [] = { 0xA2, 0x82, 0x8E, 0x86, 0 }; // "Game"
__string__ String_Tetris [] = { 0xAF, 0x86, 0x95, 0x93, 0x8A, 0x94, 0 }; // "Tetris"
__string__ String_Easy [] = { 0xA0, 0x82, 0x94, 0x9A, 0 }; // "Easy"
__string__ String_Normal [] = { 0xA9, 0x90, 0x93, 0x8E, 0x82, 0x8D, 0 }; // "Normal"
__string__ String_Hard [] = { 0xA3, 0x82, 0x93, 0x85, 0 }; // "Hard"
@@ -196,4 +197,13 @@ __string__ String_ProfPlus [] = { 0xAB, 0x93, 0x90, 0x87, 0xC1, 0xBD, 0xD4, 0xD4
__string__ String_Curve [] = { 0x9E, 0x96, 0x93, 0x97, 0x86, 0 };
__string__ String_Enable [] = { 0xA0, 0x8F, 0x82, 0x83, 0x8D, 0x86, 0 };
__string__ String_Reset [] = { 0xAD, 0x86, 0x94, 0x86, 0x95, 0 };
__string__ String_Splash [] = { 0xAE, 0x91, 0x8D, 0x82, 0x94, 0x89, 0 };
__string__ String_Splash [] = { 0xAE, 0x91, 0x8D, 0x82, 0x94, 0x89, 0 };
__string__ String_Sunday [] = { 0xAE, 0x7C, 0x75, 0x6B, 0x68, 0x80, 0 };
__string__ String_Monday [] = { 0xA8, 0x76, 0x75, 0x6B, 0x68, 0x80, 0 };
__string__ String_Tuesday [] = { 0xAF, 0x7C, 0x6C, 0x7A, 0x6B, 0x68, 0x80, 0 };
__string__ String_Wednesday [] = { 0xB2, 0x6C, 0x6B, 0x75, 0x6C, 0x7A, 0x6B, 0x68, 0x80, 0 };
__string__ String_Thursday [] = { 0xAF, 0x6F, 0x7C, 0x79, 0x7A, 0x6B, 0x68, 0x80, 0 };
__string__ String_Friday [] = { 0xA1, 0x79, 0x70, 0x6B, 0x68, 0x80, 0 };
__string__ String_Saturday [] = { 0xAE, 0x68, 0x7B, 0x7C, 0x79, 0x6B, 0x68, 0x80, 0 };
__string__ String_Survival [] = { 0xAE, 0x96, 0x93, 0x97, 0x8A, 0x97, 0x82, 0x8D, 0 };

866 changes: 866 additions & 0 deletions src/tetris.c

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/timers.c
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
#include "battery.h"
#include "atomizer.h"
#include "flappy.h"
#include "tetris.h"
#include "display.h"
#include "miscs.h"

@@ -120,6 +121,15 @@ __myevic__ void TMR2_IRQHandler()
fbTickTimeouts();
}
}
if ( gFlags.playing_tt )
{
if ( (!(TMR2Counter % 20) && dfTTSpeed == 0)
|| (!(TMR2Counter % 10) && (dfTTSpeed == 1 || dfTTSpeed == 2)))
// || (!(TMR2Counter % 5) && dfTTSpeed == 2) ) //5 10 15
{
ttTickTimeouts();
}
}
}
}

13 changes: 13 additions & 0 deletions src/ttdata.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <sys/types.h>
#include <stdint.h>

const uint8_t Blocks[7][2] ={
{ 0b01100000, 0b00000110}, //O
{ 0b11110000, 0b00000000}, //I
{ 0b11000000, 0b00000110}, //S
{ 0b01100000, 0b00001100}, //Z
{ 0b11100000, 0b00000010}, //L
{ 0b11100000, 0b00001000}, //J
{ 0b11100000, 0b00000100} //T

};