Skip to content

Commit 4f6bcb7

Browse files
committed
Fix Arduino sketch
Fix quickboot executing in XBE version
1 parent aa34c0b commit 4f6bcb7

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

Arduino_debugger/SPI_UART_text_bridge/SPI_UART_text_bridge.ino

+14-13
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3434

3535
#include <SPI.h>
3636

37-
#define ringBufferSize 800 // To accommodate ATMega168 devices with 1KB SRAM
37+
#define ringBufferSize 750 // To accommodate ATMega168 devices with 1KB SRAM
3838
unsigned char buf[ringBufferSize];
3939

4040
unsigned short dataInPos = 0;
@@ -63,16 +63,16 @@ void setup (void)
6363
// SPI interrupt routine
6464
ISR (SPI_STC_vect)
6565
{
66-
if(ringBufRollOver == false || dataInPos < dataOutPos)
66+
if(ringBufRollOver == false || (dataInPos + 1) < dataOutPos)
6767
{
6868
// Drop byte if ring buffer is full
69-
buf[dataInPos++] = SPDR;
70-
71-
if(dataInPos >= ringBufferSize)
72-
{
73-
dataInPos = 0;
74-
ringBufRollOver = true;
75-
}
69+
buf[dataInPos++] = SPDR;
70+
71+
if(dataInPos >= ringBufferSize)
72+
{
73+
dataInPos = 0;
74+
ringBufRollOver = true;
75+
}
7676
}
7777
}
7878

@@ -84,10 +84,11 @@ void loop (void)
8484
if((dataOutPos != dataInPos) || (dataOutPos == 0 && dataInPos == 0 && ringBufRollOver == true))
8585
{
8686
Serial.write(buf[dataOutPos++]);
87-
if(dataOutPos >= ringBufferSize)
88-
{
89-
ringBufRollOver = false;
90-
}
87+
if(dataOutPos >= ringBufferSize)
88+
{
89+
dataOutPos = 0;
90+
ringBufRollOver = false;
91+
}
9192
}
9293
}
9394
}

boot/BootResetAction.c

+15-12
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,21 @@ extern void BootResetAction ( void )
380380
I2CTransmitWord(0x10, 0x0c01); // close DVD tray
381381
}
382382

383-
if(LPCmodSettings.OSsettings.Quickboot)
384-
{
385-
// No quickboot if both button pressed at that point.
386-
if(EjectButtonPressed == 0)
387-
{
388-
if(LPCmodSettings.OSsettings.activeBank != BNKOS)
389-
{
390-
debugSPIPrint("Going to Quickboot.\n");
391-
quickboot(LPCmodSettings.OSsettings.activeBank);
392-
}
393-
}
394-
}
383+
if(isXBlastOnLPC() && isXBE() == false) //Quickboot only if on the right hardware.
384+
{
385+
if(LPCmodSettings.OSsettings.Quickboot)
386+
{
387+
// No quickboot if both button pressed at that point.
388+
if(EjectButtonPressed == 0)
389+
{
390+
if(LPCmodSettings.OSsettings.activeBank != BNKOS)
391+
{
392+
debugSPIPrint("Going to Quickboot.\n");
393+
quickboot(LPCmodSettings.OSsettings.activeBank);
394+
}
395+
}
396+
}
397+
}
395398

396399
debugSPIPrint("No Quickboot or EjectButton boot this time.\n");
397400
initialSetLED(LPCmodSettings.OSsettings.LEDColor);

0 commit comments

Comments
 (0)