imporve VM run sys info output

This commit is contained in:
李昂 2021-10-26 20:31:56 +08:00
parent d4e60e302c
commit 5497dde01c
4 changed files with 31 additions and 18 deletions

View File

@ -740,6 +740,11 @@
<FileType>1</FileType>
<FilePath>..\pikascript\pikascript-api\PikaPiZero_OLED-api.c</FilePath>
</File>
<File>
<FileName>PikaPiZero_Point-api.c</FileName>
<FileType>1</FileType>
<FilePath>..\pikascript\pikascript-api\PikaPiZero_Point-api.c</FilePath>
</File>
</Files>
</Group>
<Group>

View File

@ -2,27 +2,31 @@ import PikaStdLib
import STM32
import PikaPiZero
x = 0
y = 0
p0 = PikaPiZero.Point()
p0.x = 0
p0.y = 0
print(p0.x)
mem = PikaStdLib.MemChecker()
print('mem used max:')
mem.max()
oled.drawPoint(x, y)
oled.drawPoint(p0.x, p0.y)
while True:
if right.read() == 1:
if x < 15:
x = x + 1
oled.drawPoint(x, y)
print('right')
if p0.x < 15:
p0.x = p0.x + 1
print(p0.x)
oled.drawPoint(p0.x, p0.y)
if left.read() == 0:
if x > 0:
x = x - 1
oled.drawPoint(x, y)
if p0.x > 0:
p0.x = p0.x - 1
oled.drawPoint(p0.x, p0.y)
if up.read() == 0:
if y > 0:
y = y - 1
oled.drawPoint(x, y)
if p0.y > 0:
p0.y = p0.y - 1
oled.drawPoint(p0.x, p0.y)
if down.read() == 0:
if y < 7:
y = y + 1
oled.drawPoint(x, y)
if p0.y < 7:
p0.y = p0.y + 1
oled.drawPoint(p0.x, p0.y)

View File

@ -517,7 +517,7 @@ nextLine:
return nextAddr;
}
static char* useFlashAsBuff(char* pikaAsm, Args* buffs) {
char* useFlashAsBuff(char* pikaAsm, Args* buffs) {
/* not write flash when asm is old */
if (strEqu(pikaAsm, __platformLoadPikaAsm())) {
args_deinit(buffs);
@ -561,7 +561,10 @@ Args* pikaVM_runAsm(PikaObj* self, char* pikaAsm) {
__platformPrintf("%s\r\n", sysOut);
}
if (0 != errcode) {
__platformPrintf("[info] input commond: %s\r\n", thisLine);
Args *buffs = New_strBuff();
char *onlyThisLine = strsGetFirstToken(buffs, thisLine, '\n');
__platformPrintf("[info] input commond: %s\r\n", onlyThisLine);
args_deinit(buffs);
}
}
__clearInvokeQueues(self);

View File

@ -9,5 +9,6 @@ int32_t pikaVM_runAsmLine(PikaObj* self,
int32_t lineAddr,
Args* sysRes);
int32_t __clearInvokeQueues(PikaObj* self);
char* useFlashAsBuff(char* pikaAsm, Args* buffs);
#endif