options.txt numbers can now be decimal, hex (and probably octal)

reboot clears LCD on the way down
This commit is contained in:
penfold42 2018-08-25 11:43:23 +10:00
parent 29aa351b9b
commit 5b091e9b8c
4 changed files with 14 additions and 26 deletions

View File

@ -23,8 +23,8 @@
extern "C" extern "C"
{ {
#include "rpi-aux.h" #include "rpi-aux.h"
extern void reboot_now(void);
} }
extern void Reboot_Pi(void);
// If disk swaps can be done via multiple cores then directDiskSwapRequest needs to be volatile. WARNING: volatile acesses can be very expensive. // If disk swaps can be done via multiple cores then directDiskSwapRequest needs to be volatile. WARNING: volatile acesses can be very expensive.
//volatile unsigned InputMappings::directDiskSwapRequest = 0; //volatile unsigned InputMappings::directDiskSwapRequest = 0;
@ -204,7 +204,7 @@ bool InputMappings::CheckKeyboardBrowseMode()
} }
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() ) if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
reboot_now(); Reboot_Pi();
if (keyboard->KeyHeld(KEY_ESC)) if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG); SetKeyboardFlag(ESC_FLAG);
@ -295,7 +295,7 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
return; return;
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() ) if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
reboot_now(); Reboot_Pi();
if (keyboard->KeyHeld(KEY_ESC)) if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG); SetKeyboardFlag(ESC_FLAG);

View File

@ -47,9 +47,7 @@
extern unsigned versionMajor; extern unsigned versionMajor;
extern unsigned versionMinor; extern unsigned versionMinor;
extern "C" { extern void Reboot_Pi();
extern void reboot_now(void);
}
#define WaitWhile(checkStatus) \ #define WaitWhile(checkStatus) \
do\ do\
@ -1232,7 +1230,7 @@ void IEC_Commands::User(void)
break; break;
case 202: case 202:
// Really hard reset - reboot Pi // Really hard reset - reboot Pi
reboot_now(); Reboot_Pi();
break; break;
case '0': case '0':
//OPEN1,8,15,"U0>"+CHR$(9):CLOSE1 //OPEN1,8,15,"U0>"+CHR$(9):CLOSE1

View File

@ -1291,6 +1291,13 @@ static void CheckOptions()
} }
} }
void Reboot_Pi()
{
if (screenLCD)
screenLCD->ClearInit(0);
reboot_now();
}
extern "C" extern "C"
{ {
void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags) void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags)

View File

@ -299,26 +299,9 @@ void Options::Process(char* buffer)
unsigned Options::GetDecimal(char* pString) unsigned Options::GetDecimal(char* pString)
{ {
if (pString == 0 || *pString == '\0') if (pString == 0 || *pString == '\0')
return INVALID_VALUE; return 0;
unsigned nResult = 0; return strtol(pString, NULL, 0);
char chChar = *pString++;
while (chChar != '\0' && chChar != 13)
{
if (!('0' <= chChar && chChar <= '9'))
return INVALID_VALUE;
unsigned nPrevResult = nResult;
nResult = nResult * 10 + (chChar - '0');
if (nResult < nPrevResult || nResult == INVALID_VALUE)
return INVALID_VALUE;
chChar = *pString++;
}
return nResult;
} }
float Options::GetFloat(char* pString) float Options::GetFloat(char* pString)