Skip to content

Commit

Permalink
fix ansiSerial example reboot on Esp8266
Browse files Browse the repository at this point in the history
  • Loading branch information
neu-rah committed Oct 10, 2017
1 parent d41502a commit f5a0e1a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 46 deletions.
37 changes: 15 additions & 22 deletions examples/Serial/ansiSerial/ansiSerial/ansiSerial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ Print& operator<<(Print&o, Menu::prompt&p) {
}
#endif

#ifdef ARDUINO_SAM_DUE
#define LEDPIN 13
#else
#define LEDPIN A3
#endif
#define LEDPIN LED_BUILTIN

// define menu colors --------------------------------------------------------
//each color is in the format:
Expand All @@ -55,13 +51,13 @@ const colorDef<uint8_t> colors[] MEMMODE={

//define menu outputs ------------------------------------------------
#define MAX_DEPTH 4
/*const panel panels[] MEMMODE={{1,1,16,10},{18,1,16,10},{36,1,16,10}};
navNode* nodes[sizeof(panels)/sizeof(panel)];
panelsList pList(panels,nodes,sizeof(panels)/sizeof(panel));
idx_t ansi_tops[MAX_DEPTH];
ansiSerialOut ansi(Serial,colors,ansi_tops,pList);//the output device, ansi-terminal Cols x Rows
menuOut* outputs[]={&ansi};
outputsList out(outputs,1);*/
// const panel panels[] MEMMODE={{1,1,16,10},{18,1,16,10},{36,1,16,10}};
// navNode* nodes[sizeof(panels)/sizeof(panel)];
// panelsList pList(panels,nodes,sizeof(panels)/sizeof(panel));
// idx_t ansi_tops[MAX_DEPTH];
// ansiSerialOut ansi(Serial,colors,ansi_tops,pList);//the output device, ansi-terminal Cols x Rows
// menuOut* outputs[]={&ansi};
// outputsList out(outputs,1);

MENU_OUTPUTS(out,MAX_DEPTH
,ANSISERIAL_OUT(Serial,colors,{1,1,16,10})//,{18,1,16,10},{36,1,16,10})
Expand Down Expand Up @@ -238,11 +234,11 @@ MENU(subMenu,"Sub-Menu",showEvent,anyEvent,noStyle
,EXIT("<Back")
);

extern menu mainMenu;
TOGGLE((mainMenu[1].enabled),togOp,"Op 2:",doNothing,noEvent,noStyle
,VALUE("Enabled",enabledStatus,doNothing,noEvent)
,VALUE("disabled",disabledStatus,doNothing,noEvent)
);
// extern menu mainMenu;
// TOGGLE((mainMenu[1].enabled),togOp,"Op 2:",doNothing,noEvent,noStyle
// ,VALUE("Enabled",enabledStatus,doNothing,noEvent)
// ,VALUE("disabled",disabledStatus,doNothing,noEvent)
// );

result alert(menuOut& o,idleEvent e) {
if (e==idling)
Expand Down Expand Up @@ -303,19 +299,16 @@ void setup() {
pinMode(LEDPIN,OUTPUT);
Serial.begin(9600);
while(!Serial);
Serial.println("ok");
Serial<<"menu 3.0 test"<<endl;Serial.flush();
nav.idleTask=idle;//point a function to be used when menu is suspended
mainMenu[1].enabled=disabledStatus;
nav.showTitle=true;
//nav.printMenu(1);
//ansi.fill(1, 1, 2, 2, 'X');
//Serial<<"pList[0]:{"<<pList[0].x<<","<<pList[0].y<<","<<pList[0].w<<","<<pList[0].h<<"}"<<endl;
delay(1000);
}

void loop() {
nav.poll();
digitalWrite(LEDPIN, ledCtrl);
//digitalWrite(LEDPIN,!digitalRead(LEDPIN));
delay(100);//simulate a delay when other tasks are done
delay(100);
}
21 changes: 11 additions & 10 deletions examples/Serial/ansiSerial/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
src_dir=ansiSerial
lib_dir=~/Arduino/Libraries

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing
; [env:nanoatmega328]
; platform = atmelavr
; board = nanoatmega328
; framework = arduino
; build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing

;[env:teensy31]
;platform = teensy
Expand All @@ -35,8 +35,9 @@ build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-
;framework = arduino
;build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing -lstdc++

; [env:esp12e]
; platform = espressif8266
; board = esp12e
; framework = arduino
; build_flags = -Wno-comment -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing -DDEBUG
[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
upload_speed=921600
build_flags = -Wno-comment -Wno-strict-aliasing -Wno-builtin-macro-redefined -DNODEBUG
23 changes: 9 additions & 14 deletions examples/Serial/serialio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,14 @@ src_dir=serialio
;framework = arduino
;build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing -lstdc++

; [env:nodemcu-32]
; platform = espressif32s
; board = nodemcu-32s
; framework = arduino
; build_flags = -Wno-comment -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing -DDEBUG
[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
upload_speed=921600
build_flags = -Wno-comment -Wno-strict-aliasing -Wno-builtin-macro-redefined -DNODEBUG

; [env:esp12e]
; platform = espressif8266
; board = esp12e
; [env:uno]
; platform = atmelavr
; board = uno
; framework = arduino
; build_flags = -Wno-comment -Wno-strict-aliasing -Wno-builtin-macro-redefined -Wno-strict-aliasing -DDEBUG

[env:uno]
platform = atmelavr
board = uno
framework = arduino

0 comments on commit f5a0e1a

Please sign in to comment.