microbit-foundation / pxt-ml-runner-poc

MIT License
0 stars 0 forks source link

Error: expected type-specifier before 'MicroBitButton' #1

Closed microbit-carlos closed 1 month ago

microbit-carlos commented 1 month ago

Al the end of building locally:

$ PXT_FORCE_LOCAL=1 PXT_NODOCKER=1 PXT_COMPILE_SWITCHES=csv---mbcodal npx pxt
...
/Users/microbit-carlos/workspace/mbef/editor-ml/pxt-project/pxt-ml-runner-poc/built/codal/pxtapp/core/pins.cpp: In function 'void pins::pushButton(DigitalPin)':
/Users/microbit-carlos/workspace/mbef/editor-ml/pxt-project/pxt-ml-runner-poc/built/codal/pxtapp/core/pins.cpp:647:13: error: expected type-specifier before 'MicroBitButton'
  647 |         new MicroBitButton((PinName)getPin((int)(pin))->name, (int)pin, MICROBIT_BUTTON_ALL_EVENTS, PinMode::PullUp);
      |             ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/MICROBIT.dir/pxtapp/core/pins.cpp.obj] Error 1
make[1]: *** [CMakeFiles/MICROBIT.dir/all] Error 2
make: *** [all] Error 2
INTERNAL ERROR: Error: Exit code: 1 from cd built/codal; python build.py
    at ChildProcess.<anonymous> (/Users/microbit-carlos/workspace/mbef/editor-ml/pxt-project/pxt-ml-runner-poc/node_modules/pxt-core/built/nodeutil.js:78:24)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
microbit-carlos commented 1 month ago

Local workaround

This has been fixed in pxt-microbit v6.1.10, and CODAL 0.2.65, but the CODAL tag has not been released yet and the MakeCode fix is only in beta.

The current workaround is to follow the README instructions to force pxt-microbit@6.1.10:

cp node_modules/pxtcli.json ./pxtcli.json
npm install pxt-microbit@6.1.10 --no-save
mv ./pxtcli.json node_modules/pxtcli.json
npx pxt install

Online MakeCode editor workaround

This error can also appear on MakeCode (printed in the js console), the workaround is to use MakeCode beta.

microbit-carlos commented 1 month ago

This can be close as resolved by changing the built-in model to a smaller one, so that BLE doesn't need to be disabled.