Fix multi-line startup command for BL602 (#1529)

This commit is contained in:
giedriuslt
2025-02-04 14:13:06 +02:00
committed by GitHub
parent a5b536b0d5
commit 0c517431d8
2 changed files with 7 additions and 10 deletions

View File

@ -246,7 +246,7 @@ typedef struct scriptInstance_s {
} scriptInstance_t;
int g_scrBufferSize = 0;
char *g_scrBuffer = 0;
char *g_scrBuffer = NULL;
int svm_deltaMS;
scriptFile_t *g_scriptFiles = 0;
scriptInstance_t *g_scriptThreads = 0;
@ -365,6 +365,11 @@ void SVM_RunThread(scriptInstance_t *t, int maxLoops) {
int loop = 0;
const char *start, *end;
int len, p;
if(g_scrBuffer == NULL) {
g_scrBufferSize = 256;
g_scrBuffer = malloc(g_scrBufferSize + 1);
}
while(1) {
loop++;
@ -432,10 +437,6 @@ void SVM_RunThreads(int deltaMS) {
c_run = 0;
svm_deltaMS = deltaMS;
if(g_scrBuffer == 0) {
g_scrBufferSize = 256;
g_scrBuffer = malloc(g_scrBufferSize + 1);
}
g_activeThread = g_scriptThreads;
while(g_activeThread) {

View File

@ -1119,11 +1119,7 @@ void Main_Init_AfterDelay_Unsafe(bool bStartAutoRunScripts) {
// NOTE: this will try to read autoexec.bat,
// so ALL commands expected in autoexec.bat should have been registered by now...
#if PLATFORM_BL602
// temporary fix
CMD_ExecuteCommand(CFG_GetShortStartupCommand(), COMMAND_FLAG_SOURCE_SCRIPT);
#elif ENABLE_OBK_SCRIPTING
#if ENABLE_OBK_SCRIPTING
SVM_RunStartupCommandAsScript();
#else
CMD_ExecuteCommand(CFG_GetShortStartupCommand(), COMMAND_FLAG_SOURCE_SCRIPT);