Skip to content

Enabling plasma plugin on RP2040 #7

@JelmerV

Description

@JelmerV

Hi, I am trying to use the PicoCNC board with the RP2040 for a DIY plasma cutter and am trying to get THC working. The analog input will be the ADC on GPIO28, moving the probe pin to 24. I also ordered an I2C ADC chip but that's a later step.

However, I am immediately running into problems while trying to add the plasma plugin. I added an include "plasma.c" within driver.h but it contains redefinitions of multiple functions causing the compilation to fail. (side question: why was the plasma.h file removed in some recent change?) In summary the errors are for redefinitions of the 'digital_out', 'analog_out', 'stepperPulseStart', and 'enumeratePins' functions, and for the 'settings_changed' variable. Here is the full output:

....
[ 17%] Building C object CMakeFiles/grblHAL.dir/ioports_analog.c.obj
/home/jelmer/grblHAL_driver_RP2040/pico_cnc.c:51:13: error: redefinition of 'digital_out'
   51 | static void digital_out (uint8_t port, bool on)
      |             ^~~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
                 from /home/jelmer/grblHAL_driver_RP2040/pico_cnc.c:26:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:137:13: note: previous definition of 'digital_out' was here
  137 | static void digital_out (uint8_t portnum, bool on)
      |             ^~~~~~~~~~~
make[2]: *** [CMakeFiles/grblHAL.dir/build.make:202: CMakeFiles/grblHAL.dir/pico_cnc.c.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/jelmer/grblHAL_driver_RP2040/ioports_analog.c:89:13: error: redefinition of 'analog_out'
   89 | static bool analog_out (uint8_t port, float value)
      |             ^~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
                 from /home/jelmer/grblHAL_driver_RP2040/ioports_analog.c:22:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:159:13: note: previous definition of 'analog_out' was here
  159 | static bool analog_out (uint8_t portnum, float value)
      |             ^~~~~~~~~~
In file included from /home/jelmer/pico/pico-sdk/src/common/pico_base/include/pico.h:33,
                 from /home/jelmer/pico/pico-sdk/src/common/pico_time/include/pico/time.h:10,
                 from /home/jelmer/grblHAL_driver_RP2040/driver.c:31:
/home/jelmer/grblHAL_driver_RP2040/driver.c:1048:33: error: redefinition of 'stepperPulseStart'
 1048 | static void __not_in_flash_func(stepperPulseStart)(stepper_t *stepper)
      |                                 ^~~~~~~~~~~~~~~~~
/home/jelmer/pico/pico-sdk/src/rp2_common/pico_platform/include/pico/platform.h:265:76: note: in definition of macro '__not_in_flash_func'
  265 | #define __not_in_flash_func(func_name) __not_in_flash(__STRING(func_name)) func_name
      |                                                                            ^~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
                 from /home/jelmer/grblHAL_driver_RP2040/driver.c:44:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:362:13: note: previous definition of 'stepperPulseStart' was here
  362 | static void stepperPulseStart (stepper_t *stepper)
      |             ^~~~~~~~~~~~~~~~~
/home/jelmer/grblHAL_driver_RP2040/driver.c:1764:6: error: 'settings_changed' redeclared as different kind of symbol
 1764 | void settings_changed (settings_t *settings, settings_changed_flags_t changed)
      |      ^~~~~~~~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
                 from /home/jelmer/grblHAL_driver_RP2040/driver.c:44:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:120:29: note: previous declaration of 'settings_changed' was here
  120 | static settings_changed_ptr settings_changed;
      |                             ^~~~~~~~~~~~~~~~
/home/jelmer/grblHAL_driver_RP2040/driver.c:2066:13: error: redefinition of 'enumeratePins'
 2066 | static void enumeratePins (bool low_level, pin_info_ptr pin_info, void *data)
      |             ^~~~~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
                 from /home/jelmer/grblHAL_driver_RP2040/driver.c:44:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:656:13: note: previous definition of 'enumeratePins' was here
  656 | static void enumeratePins (bool low_level, pin_info_ptr pin_info, void *data)
      |             ^~~~~~~~~~~~~
make[2]: *** [CMakeFiles/grblHAL.dir/build.make:244: CMakeFiles/grblHAL.dir/ioports_analog.c.obj] Error 1
make[2]: *** [CMakeFiles/grblHAL.dir/build.make:90: CMakeFiles/grblHAL.dir/driver.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1511: CMakeFiles/grblHAL.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

What would be the correct way of activating the plasma plugin? You mention testing this plugin already so i am also curious about the implementation that you use. I can't seem to find a complete example of the implementation within any of the hardware drivers.

Also, should STEP_INJECT_ENABLE be enabled to use THC?

My fork of the RP2040 driver can be found here for reference: https://github.com/JelmerV/grblHAL_driver_RP2040

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions