Skip to content

Commit a4a146a

Browse files
authored
Version 2.6a - 19th April 2019
Fixes technoblogy#17
1 parent fa27b1c commit a4a146a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

ulisp-esp.ino

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* uLisp ESP Version 2.6 - www.ulisp.com
2-
David Johnson-Davies - www.technoblogy.com - 9th April 2019
1+
/* uLisp ESP Version 2.6a - www.ulisp.com
2+
David Johnson-Davies - www.technoblogy.com - 19th April 2019
33
44
Licensed under the MIT license: https://opensource.org/licenses/MIT
55
*/
@@ -2895,13 +2895,16 @@ object *fn_cls (object *args, object *env) {
28952895
object *fn_pinmode (object *args, object *env) {
28962896
(void) env;
28972897
int pin = integer(first(args));
2898+
int pm = INPUT;
28982899
object *mode = second(args);
2899-
if ((integerp(mode) && mode->integer == 1) || mode != nil) pinMode(pin, OUTPUT);
2900-
else if (integerp(mode) && mode->integer == 2) pinMode(pin, INPUT_PULLUP);
2901-
#if defined(INPUT_PULLDOWN)
2902-
else if (integerp(mode) && mode->integer == 4) pinMode(pin, INPUT_PULLDOWN);
2903-
#endif
2904-
else pinMode(pin, INPUT);
2900+
if (integerp(mode)) {
2901+
int nmode = integer(mode);
2902+
if (nmode == 1) pm = OUTPUT; else if (nmode == 2) pm = INPUT_PULLUP;
2903+
#if defined(INPUT_PULLDOWN)
2904+
else if (nmode == 4) pm = INPUT_PULLDOWN;
2905+
#endif
2906+
} else if (mode != nil) pm = OUTPUT;
2907+
pinMode(pin, pm);
29052908
return nil;
29062909
}
29072910

@@ -3043,9 +3046,9 @@ void superprint (object *form, int lm, pfun_t pfun) {
30433046
else supersub(form, lm + PPINDENT, 1, pfun);
30443047
}
30453048

3046-
const int ppspecials = 15;
3049+
const int ppspecials = 16;
30473050
const char ppspecial[ppspecials] PROGMEM =
3048-
{ DOTIMES, DOLIST, IF, SETQ, TEE, LET, LETSTAR, LAMBDA, WHEN, UNLESS, WITHI2C, WITHSERIAL, WITHSPI, WITHSDCARD, WITHCLIENT };
3051+
{ DOTIMES, DOLIST, IF, SETQ, TEE, LET, LETSTAR, LAMBDA, WHEN, UNLESS, WITHI2C, WITHSERIAL, WITHSPI, WITHSDCARD, FORMILLIS, WITHCLIENT };
30493052

30503053
void supersub (object *form, int lm, int super, pfun_t pfun) {
30513054
int special = 0, separate = 1;
@@ -3673,7 +3676,7 @@ object *eval (object *form, object *env) {
36733676
object *function = car(form);
36743677
object *args = cdr(form);
36753678

3676-
if (function == NULL) error(PSTR("'nil' is an illegal function"));
3679+
if (function == NULL) error3(NIL, PSTR("is an illegal function"));
36773680
if (!listp(args)) error(PSTR("Can't evaluate a dotted pair"));
36783681

36793682
// List starts with a symbol?

0 commit comments

Comments
 (0)