Skip to content

Commit

Permalink
[#42] Fix Puffs & Time counters recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
ClockSelect committed Sep 21, 2016
1 parent 2b9c914 commit 3415d39
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Binary file modified bin/myevic.bin
Binary file not shown.
Binary file modified bin/myevic_enc.bin
Binary file not shown.
10 changes: 8 additions & 2 deletions src/dataflash.c
Expand Up @@ -117,6 +117,9 @@ __myevic__ void FMCReadCounters()
uint32_t pc, v;
uint32_t idx;

SYS_UnlockReg();
FMC_ENABLE_ISP();

for ( idx = 0 ; idx < FMC_FLASH_PAGE_SIZE ; idx += 4 )
{
v = FMC_Read( DATAFLASH_PUFFCNTR_BASE + idx );
Expand All @@ -136,6 +139,9 @@ __myevic__ void FMCReadCounters()
dfPuffCount = 0;
dfTimeCount = 0;
}

FMC_DISABLE_ISP();
SYS_LockReg();
}


Expand Down Expand Up @@ -638,11 +644,11 @@ __myevic__ void InitDataFlash()
}
}

FMCReadCounters();

FMC_DISABLE_ISP();
SYS_LockReg();

FMCReadCounters();

SetProductID();

if ( ISVTWO || ISEVICAIO || ISCUBOMINI || ISEVICBASIC )
Expand Down
9 changes: 5 additions & 4 deletions src/eh.c
Expand Up @@ -485,16 +485,17 @@ __myevic__ void EventHandler()
if ( dfStatus.phpct )
{
PreheatPower = dfPower * dfPreheatPwr / 100;
if ( PreheatPower > MaxPower )
{
PreheatPower = MaxPower;
}
}
else
{
PreheatPower = dfPreheatPwr;
}

if ( PreheatPower > AtoMaxPower )
{
PreheatPower = AtoMaxPower;
}

TargetVolts = GetVoltsForPower( PreheatPower );
}
else if ( pwr <= 300 )
Expand Down

0 comments on commit 3415d39

Please sign in to comment.