A couple of plugin-related questions


(tiltowaitt) #1
  1. What are the implications of the EventHandlerResult return values in the following event hooks?
  • onSetup()
  • beforeEachCycle()
  • beforeReportingState()
  • afterEachCycle()
  1. When developing a new plugin or using a third-party plugin not part of the Great Monorepo, what is the preferred method of including it in your sketch? (i.e. where should the source files go?)
  2. If I want to look up which layer is active, which Layer function should I use?

(Gergely Nagy) #2

At the moment, nothing, these ignore the results. The only two hooks that don’t ignore results are onKeyswitchEvent and onFocusEvent. This might change in the future, but we don’t have any concrete plans yet.

There are a number of ways you can include a plugin… you can install it into the Arduino sketch dir, or you can add it to a - say - lib/ subdir of your sketch and tell kaleidoscope-builder to search for libraries there too. I usually use this second method, via git submodules.

There can be multiple layers active at the time. You can get the topmost with Layer.top(). If you want to check all active layers, you can iterate back from Layer.top() to zero, and check each one with Layer.isActive().


(tiltowaitt) #3

Thanks for the info.

How might I tell kaleidoscope-builder where to look? In my sketch directory, I have a lib, which holds hardware. I can also put plugins there (lib/Kaleidoscope-TPPlugin). I’d like, however, to make it lib/plugins/Kaleidoscope-TPPlugin for better organization. How much I do that?

(If it helps, I shamelessly copied your own build environment and made some minor modifications to fit my own needs.)


(Gergely Nagy) #4

Put this in .kaleidoscope-builder.conf: EXTRA_BUILDER_ARGS="-libraries lib/plugins"

You can have the hardware libs in lib/hardware still, that’s another setting, BOARD_HARDWARE_PATH.