Trouble getting MagicCombo example to work

plugin
question

(Neal Harris) #1

Plugin name: MagicCombo

Description:

While trying to flash my Model01 with the example at https://github.com/keyboardio/Kaleidoscope-MagicCombo/blob/master/examples/MagicCombo/MagicCombo.ino, I encounter the following error:

error: expected constructor, destructor, or type conversion before ‘(’ token
USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}});

Has anyone run into this before? Am I missing something silly?


(Gergely Nagy) #3

Are you using the git master version of MagicCombo, or the one that can be installed via the Arduino IDE?


(Neal Harris) #4

I’m on https://github.com/keyboardio/Kaleidoscope-MagicCombo/commit/61d70b5cacff7bb41d81409fd1d5822aac85702f .


(Neal Harris) #5

Though I just updated, and get the same error on a8f2f90ef5cc19bda26fb24d114e9adb6f1a6e1b.


(Gergely Nagy) #6

That’s weird, 'cos the example compiles on Travis too. I tried rolling Kaleidoscope (and -Hardware-Model01) back, before we changed the RxCy macros, but that fails with a different error.

I assume you use the command-line interface? If so, can you try running make VERBOSE=1? The thing to look for is duplicate instances of MagicCombo, or building it from a path different than your git checkout.


(Neal Harris) #7

Indeed, I seem to have multiple instances of it on my machine:

Multiple libraries were found for "Kaleidoscope-MagicCombo.h"
 Used: /Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo
 Not used: /Users/neal/Development/Arduino/hardware/keyboardio/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src

I seem to have moved past my previous error, though, and am now on to this:

Ξ Arduino/Model01-Firmware git:(magic-combo) ▶ make
BOARD_HARDWARE_PATH="/Users/neal/Documents/Arduino/hardware" /Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder build-all
Building output/Model01-Firmware/Model01-Firmware (0.0.0-gv1.22-14-gbcd6-dirty) ...
In file included from /Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope-MagicCombo.h:21:0,
                 from /Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:21:
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.h:28:72: warning: narrowing conversion of '33554432ul' from 'uint32_t {aka long unsigned int}' to 'int8_t {aka signed char}' inside { } [-Wnarrowing]
   const kaleidoscope::MagicCombo::Combo combos[] PROGMEM = {__VA_ARGS__}; \
                                                                        ^
/Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:31:1: note: in expansion of macro 'USE_MAGIC_COMBOS'
 USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}});
 ^
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.h:28:72: warning: overflow in implicit constant conversion [-Woverflow]
   const kaleidoscope::MagicCombo::Combo combos[] PROGMEM = {__VA_ARGS__}; \
                                                                        ^
/Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:31:1: note: in expansion of macro 'USE_MAGIC_COMBOS'
 USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}});
 ^
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.h:28:72: warning: narrowing conversion of '1073741824ul' from 'uint32_t {aka long unsigned int}' to 'int8_t {aka signed char}' inside { } [-Wnarrowing]
   const kaleidoscope::MagicCombo::Combo combos[] PROGMEM = {__VA_ARGS__}; \
                                                                        ^
/Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:31:1: note: in expansion of macro 'USE_MAGIC_COMBOS'
 USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}});
 ^
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.h:28:72: warning: overflow in implicit constant conversion [-Woverflow]
   const kaleidoscope::MagicCombo::Combo combos[] PROGMEM = {__VA_ARGS__}; \
                                                                        ^
/Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:31:1: note: in expansion of macro 'USE_MAGIC_COMBOS'
 USE_MAGIC_COMBOS([KIND_OF_MAGIC] = {.action = kindOfMagic, .keys = {R3C6, R3C9}});
 ^
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.cpp: In member function 'kaleidoscope::EventHandlerResult kaleidoscope::MagicCombo::beforeReportingState()':
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.cpp:37:33: error: 'class Model01' has no member named 'isKeyswitchPressed'
       match &= KeyboardHardware.isKeyswitchPressed(comboKey);
                                 ^
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.cpp:42:31: error: 'class Model01' has no member named 'pressedKeyswitchCount'
     if (j != KeyboardHardware.pressedKeyswitchCount())
                               ^
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.cpp: In member function 'virtual void kaleidoscope::MagicCombo::begin()':
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.cpp:59:42: warning: 'static void kaleidoscope::Kaleidoscope_::useLoopHook(kaleidoscope::Kaleidoscope_::loopHook)' is deprecated (declared at /Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/src/Kaleidoscope.h:182):
------------------------------------------------------------------------
The legacy plugin API based on hook registration is deprecated.

Consider upgrading your plugins, or implementing the new interface
described by `kaleidoscope::Plugin`. In particular, instead of using
`Kaleidoscope.useLoopHook`, implement `.beforeEachCycle`,
`.beforeReportingState()`, or `.afterEachCycle()` instead.

If your plugins are up-to-date, and you are not a developer, it is
usually safe to ignore this message. Especally if the full error
points to a line containing `legacyLoopHook` or `legacyEventHandler`.
------------------------------------------------------------------------
 [-Wdeprecated-declarations]
   Kaleidoscope.useLoopHook(legacyLoopHook);
                                          ^
exit status 1
make: *** [build-all] Error 1

I’m trying to avoid using the Arduino IDE, but am having trouble keeping the toolchain organized and updated without it…


(Gergely Nagy) #8

Progress! You’ll need to update the Kaleidoscope and Kaleidoscope-Hardware-Model01 libraries too.

I found that the easiest way to keep up-to-date is to run make maintainer-update-submodules in my Arduino-Boards checkout. That updates everything to master, pretty much.


(Neal Harris) #9

Ah, thanks for the tip!

Okay, after all of that, I now have:

Arduino/Model01-Firmware git:(customizations) ▶ make
BOARD_HARDWARE_PATH="/Users/neal/Documents/Arduino/hardware" /Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder build-all
Building output/Model01-Firmware/Model01-Firmware (0.0.0-gv1.22-20-g7da1-dirty) ...
In file included from /Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope-MagicCombo.h:21:0,
                 from /Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:69:
/Users/neal/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope-MagicCombo/src/Kaleidoscope/MagicCombo.h:28:72: sorry, unimplemented: non-trivial designated initializers not supported
   const kaleidoscope::MagicCombo::Combo combos[] PROGMEM = {__VA_ARGS__}; \
                                                                        ^
/Users/neal/Documents/Arduino/Model01-Firmware/Model01-Firmware.ino:95:1: note: in expansion of macro 'USE_MAGIC_COMBOS'
 USE_MAGIC_COMBOS(
 ^
exit status 1
make: *** [build-all] Error 1

(Gergely Nagy) #10

Did you add anything to the enum that lists KIND_OF_MAGIC?


(Neal Harris) #11

Heh, that was it. I had just rammed that into another enum for some other macros, but that totally didn’t make any sense.

Anyway, great success! Now pressing both fn keys locks my screen, which is what I wanted.

Thank you so much for your help!