Update for use with link-E

This commit is contained in:
CNLohr
2023-05-06 18:23:03 -04:00
parent 210d7e6461
commit 21a0468b5d
2 changed files with 70 additions and 61 deletions

View File

@@ -229,14 +229,17 @@ int main()
CNFGDrawText( "Press R to enable reg debug.", 2 );
}
int timeout = 0;
int timeout;
timeout = 0;
const int maxtimeout = 30;
retry:
status = 0xffffffc0;
r = MCFO->ReadReg32( dev, DMDATA0, &status );
if( ( status & 0xc0 ) == 0x40 && timeout++ < 10 ) goto retry;
if( r && timeout++ < 10 ) { printf( "R: %d\n", r ); status = 0; goto retry; }
if( timeout >= 10 )
if( ( ( status & 0xc0 ) == 0x40 || status == 0 || status == 0xffffffff ) && timeout++ < maxtimeout ) goto retry;
if( r && timeout++ < maxtimeout ) { printf( "R: %d\n", r ); status = 0; goto retry; }
if( timeout >= maxtimeout )
{
CNFGColor( 0xc0c0c0ff );
CNFGPenX = 200;
@@ -244,6 +247,13 @@ int main()
CNFGDrawText( "Timeout on command.", 5 );
}
if( status == 0xffffffff || status == 0x00000000 )
{
MCFO->SetupInterface( dev );
if( MCFO->HaltMode ) MCFO->HaltMode( dev, 2 );
}
else
{
CNFGColor( 0xc0c0c0ff );
CNFGPenX = 590;
CNFGPenY = 1;
@@ -306,7 +316,6 @@ int main()
}
}
{
int vhp = (volthisthead - 1 + VOLTHISTSIZE*100)%VOLTHISTSIZE;
float vl = voltage;
CNFGColor( GLOW );