Skip to content

Commit 8e1bdf8

Browse files
authored
Version 3.6 - 4th April 2021
1 parent a606fc7 commit 8e1bdf8

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

ulisp-esp.ino

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* uLisp ESP Version 3.5 - www.ulisp.com
2-
David Johnson-Davies - www.technoblogy.com - 16th February 2021
1+
/* uLisp ESP Version 3.6 - www.ulisp.com
2+
David Johnson-Davies - www.technoblogy.com - 4th April 2021
33
44
Licensed under the MIT license: https://opensource.org/licenses/MIT
55
*/
@@ -208,7 +208,7 @@ char LastChar = 0;
208208
char LastPrint = 0;
209209

210210
// Flags
211-
enum flag { PRINTREADABLY, RETURNFLAG, ESCAPE, EXITEDITOR, LIBRARYLOADED, NOESC };
211+
enum flag { PRINTREADABLY, RETURNFLAG, ESCAPE, EXITEDITOR, LIBRARYLOADED, NOESC, NOECHO };
212212
volatile uint8_t Flags = 0b00001; // PRINTREADABLY set by default
213213

214214
// Forward references
@@ -561,14 +561,14 @@ unsigned int loadimage (object *arg) {
561561
else error(LOADIMAGE, PSTR("illegal argument"), arg);
562562
if (!file) error2(LOADIMAGE, PSTR("problem loading from SD card"));
563563
SDReadInt(file);
564-
int imagesize = SDReadInt(file);
564+
unsigned int imagesize = SDReadInt(file);
565565
GlobalEnv = (object *)SDReadInt(file);
566566
GCStack = (object *)SDReadInt(file);
567567
#if SYMBOLTABLESIZE > BUFFERSIZE
568568
SymbolTop = (char *)SDReadInt(file);
569569
for (int i=0; i<SYMBOLTABLESIZE; i++) SymbolTable[i] = file.read();
570570
#endif
571-
for (int i=0; i<imagesize; i++) {
571+
for (unsigned int i=0; i<imagesize; i++) {
572572
object *obj = &Workspace[i];
573573
car(obj) = (object *)SDReadInt(file);
574574
cdr(obj) = (object *)SDReadInt(file);
@@ -580,15 +580,15 @@ unsigned int loadimage (object *arg) {
580580
EEPROM.begin(EEPROMSIZE);
581581
int addr = 0;
582582
EpromReadInt(&addr); // Skip eval address
583-
int imagesize = EpromReadInt(&addr);
584-
if (imagesize == 0 || imagesize == 0xFFFF) error2(LOADIMAGE, PSTR("no saved image"));
583+
unsigned int imagesize = EpromReadInt(&addr);
584+
if (imagesize == 0 || imagesize == 0xFFFFFFFF) error2(LOADIMAGE, PSTR("no saved image"));
585585
GlobalEnv = (object *)EpromReadInt(&addr);
586586
GCStack = (object *)EpromReadInt(&addr);
587587
#if SYMBOLTABLESIZE > BUFFERSIZE
588588
SymbolTop = (char *)EpromReadInt(&addr);
589589
for (int i=0; i<SYMBOLTABLESIZE; i++) SymbolTable[i] = EEPROM.read(addr++);
590590
#endif
591-
for (int i=0; i<imagesize; i++) {
591+
for (unsigned int i=0; i<imagesize; i++) {
592592
object *obj = &Workspace[i];
593593
car(obj) = (object *)EpromReadInt(&addr);
594594
cdr(obj) = (object *)EpromReadInt(&addr);
@@ -3394,7 +3394,7 @@ object *fn_pinmode (object *args, object *env) {
33943394
int pin = checkinteger(PINMODE, first(args));
33953395
PinMode pm = INPUT;
33963396
object *arg = second(args);
3397-
if (keywordp(arg)) pm = checkkeyword(PINMODE, arg);
3397+
if (keywordp(arg)) pm = (PinMode)checkkeyword(PINMODE, arg);
33983398
else if (integerp(arg)) {
33993399
int mode = arg->integer;
34003400
if (mode == 1) pm = OUTPUT; else if (mode == 2) pm = INPUT_PULLUP;
@@ -4945,9 +4945,10 @@ int gserial () {
49454945
WritePtr = 0;
49464946
return '\n';
49474947
#else
4948-
while (!Serial.available());
4948+
unsigned long start = millis();
4949+
while (!Serial.available()) if (millis() - start > 1000) clrflag(NOECHO);
49494950
char temp = Serial.read();
4950-
if (temp != '\n') pserial(temp);
4951+
if (temp != '\n' && !tstflag(NOECHO)) pserial(temp);
49514952
return temp;
49524953
#endif
49534954
}
@@ -4957,8 +4958,8 @@ object *nextitem (gfun_t gfun) {
49574958
while(issp(ch)) ch = gfun();
49584959

49594960
if (ch == ';') {
4960-
while(ch != '(') ch = gfun();
4961-
ch = '(';
4961+
do { ch = gfun(); if (ch == ';' || ch == '(') setflag(NOECHO); }
4962+
while(ch != '(');
49624963
}
49634964
if (ch == '\n') ch = gfun();
49644965
if (ch == -1) return nil;
@@ -5136,7 +5137,7 @@ void setup () {
51365137
initenv();
51375138
initsleep();
51385139
initgfx();
5139-
pfstring(PSTR("uLisp 3.5 "), pserial); pln(pserial);
5140+
pfstring(PSTR("uLisp 3.6 "), pserial); pln(pserial);
51405141
}
51415142

51425143
// Read/Evaluate/Print loop

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy