grblHAL / Plugin_encoder

grblHAL encoder plugin
Other
3 stars 4 forks source link

Arduino Compiling error #1

Open einencool opened 2 years ago

einencool commented 2 years ago

Hello,

I wanted to update my machine from a version from 2021, but when I try to compile the code with Arduino IDE 1.8.13 I get the following Error. I can't flash my Teensy 4.1 Board. When I disable the Plugin in the file "mymachine.h", it works without a problem.

define QEI_ENABLE 1 // Enable quadrature encoder interfaces. Max value is 1. Requires encoder plugin.

Arduino: 1.8.13 (Windows 10), TD: 1.57, Board: "Teensy 4.1, Serial, 600 MHz, Faster, German" C:\Users\xxx\OneDrive\Dokumente\Arduino\libraries\grblHAL_Teensy4\src\encoder\encoder.c: In function 'encoder_init': C:\Users\xxx\OneDrive\Dokumente\Arduino\libraries\grblHAL_Teensy4\src\encoder\encoder.c:790:16: error: 'setting_details_t {aka struct setting_details}' has no member named 'on_get_settings' details.on_get_settings = grbl.on_get_settings; C:\Users\xxx\OneDrive\Dokumente\Arduino\libraries\grblHAL_Teensy4\src\encoder\encoder.c: At top level: C:\Users\xxx\OneDrive\Dokumente\Arduino\libraries\grblHAL_Teensy4\src\encoder\encoder.c:113:13: warning: 'mpg_move_absolute' defined but not used [-Wunused-function] static bool mpg_move_absolute (sys_state_t state, axes_signals_t axes) Fehler beim Kompilieren für das Board Teensy 4.1.

Does anyone have the same issue? Or is there something I'm missing :-)

terjeio commented 2 years ago

Replace the init function with this code:

bool encoder_init (uint_fast8_t n_encoders)
{
    if((nvs_address = nvs_alloc(sizeof(encoder_settings_t) * n_encoders))) {
        n_encoder = n_encoders;

        settings_register(&details);

        hal.encoder.get_n_encoders = get_n_encoders;
        hal.encoder.on_event = encoder_event;

        on_report_options = grbl.on_report_options;
        grbl.on_report_options = onReportOptions;
    }

    return nvs_address != 0;
}

FYI I have not tested the fix yet - will do so later.

einencool commented 2 years ago

Hi Terje, It seems, that there is a problem with the Encoder. When I activate it, it compiles with these messages, but I can't connect to the board. When I deactivate the option, it seems to work, but the encoder don't work

C:\Users\xxx\OneDrive\Dokumente\Arduino\libraries\grblHAL_Teensy4\src\encoder\encoder.c:113:13: warning: 'mpg_move_absolute' defined but not used [-Wunused-function] static bool mpg_move_absolute (sys_state_t state, axes_signals_t axes) C:\Users\xxx\OneDrive\Dokumente\Arduino\libraries\grblHAL_Teensy4\src\encoder\encoder.c:555:27: warning: 'on_get_settings' defined but not used [-Wunused-function] static setting_details_t *on_get_settings (void) Opening Teensy Loader...

terjeio commented 2 years ago

Oops, another regression...

Move these lines to line 2295 (just before the #ifUSB_SERIAL_CDC line).

I will update when I have finished some other changes that are pending (related to networking).