neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
929 stars 189 forks source link

Use of SSD1306ASCII_OUT #416

Closed rogerjames99 closed 1 year ago

rogerjames99 commented 1 year ago

This is a request for assistance not a bug.

I am really struggling to work out how to use the SSD1306ASCII_OUT macro. Specifically what is the syntax of the list of parameters to the macro. I cannot find an example anywhere. A google search on SSD1306ASCII_OUT only returns a single hit, and that is the definition of the macro in this repo. I presume that the parameters to the SSD1306AsciiOut constructor need to go in there somewhere after the id and the counter. But I am struggling with how to encode the required tops and plist parameters. These names are going to be generated by the macro itself. This is an example of the constructor

SSD1306AsciiOut outOLED(&oled, tops, pList, 8, 1+((fontH-1)>>3) );

The nearest I have got is.

Compiling .pio/build/nucleo_f103rb/src/main.cpp.o In file included from .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/menuBase.h:31, from .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/menuDefs.h:12, from .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/menu.h:15, from src/main.cpp:33: .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/macros.h:86:32: error: expected constructor, destructor, or type conversion before '(' token 86 | #define CALL(a,b,...) a##_##b(__VA_ARGS) | ^ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/macros.h:85:20: note: in expansion of macro 'CALL' 85 | #define CALL_(...) CALL(VA_ARGS) | ^~ .pio/libdeps/nucleof103rb/ArduinoMenu library/src/macros.h:80:19: note: in expansion of macro 'CALL' 80 | #define CALL(a,b) CALL(HEAD##a,HEAD##b,TAIL##a,TAIL_##b) | ^~~~~ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/baseMacros.h:58:3: note: in expansion of macro 'CALL' 58 | what(params,x)\ | ^~~~ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/baseMacros.h:7:35: note: in expansion of macro 'XFOR_EACH_2' 7 | #define CONCATENATE2(arg1, arg2) arg1##arg2 | ^~~~ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/baseMacros.h:112:42: note: in expansion of macro 'XFOREACH' 112 | #define XFOR_EACH(what, params , x, ...) XFOREACH(FOR_EACH_NARG(x, VA_ARGS), what, params, x, VA_ARGS) | ^~~~~~ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/macros.h:186:2: note: in expansion of macro 'XFOR_EACH' 186 | XFOR_EACH(CALL,WITH(VAR,id,maxDepth),__VA_ARGS__)\ | ^~~~~ src/main.cpp:61:1: note: in expansion of macro 'MENU_OUTPUTS' 61 | MENU_OUTPUTS(out,MAX_DEPTH | ^~~~ src/main.cpp:61:14: error: 'out_outPtrs' was not declared in this scope 61 | MENU_OUTPUTS(out,MAX_DEPTH | ^~~ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/macros.h:190:22: note: in definition of macro 'MENU_OUTPUTS' 190 | Menu::outputsList id(id##_outPtrs,sizeof(id##_outPtrs)/sizeof(Menu::menuOut)); | ^~ src/main.cpp:61:14: error: 'out_outPtrs' was not declared in this scope 61 | MENU_OUTPUTS(out,MAX_DEPTH | ^~~ .pio/libdeps/nucleo_f103rb/ArduinoMenu library/src/macros.h:190:42: note: in definition of macro 'MENU_OUTPUTS' 190 | Menu::outputsList id(id##_outPtrs,sizeof(id##_outPtrs)/sizeof(Menu::menuOut)); | ^~ *** [.pio/build/nucleo_f103rb/src/main.cpp.o] Error 1 =============================== [FAILED] Took 1.20 seconds ===============================

I know that this is not the right place to raise this, but I could not find a mailing list or irc.

I am lost in a maze of twisty marco defintionns.

rogerjames99 commented 1 year ago

Sorry missed out the macro call.

MENU_OUTPUTS(out,MAX_DEPTH ,SSD1306ASCII_OUT(myMenuDevice, 1, &oled, myMenuDevice_tops, myMenuDevice_pList, 8, 1+((fontH-1)>>3) ) ,NONE );