Marlin: Compile error with last Bugfix 2.0.x

Created on 27 Nov 2017  路  8Comments  路  Source: MarlinFirmware/Marlin

The last version of bugfix does not compile on my side. I get:

Compiling .pioenvs\LPC1768\src\src\gcode\parser.o
Marlin\src\gcode\motion\M290.cpp: In static member function 'static void GcodeSuite::M290()':
Marlin\src\gcode\motion\M290.cpp:63:37: error: no matching function for call to 'GCodeParser::boolval(char, bool)'
if (parser.boolval('P', true)) mod_zprobe_zoffset(offs);
^
In file included from Marlin\src\gcode\motion\../gcode.h:245:0,
from Marlin\src\gcode\motion\M290.cpp:27:
Marlin\src\gcode\motion\../parser.h:302:35: note: candidate: static bool GCodeParser::boolval(char)
FORCE_INLINE static bool        boolval(const char c)                          { return seenval(c) ? value_bool()         : seen(c); }
^~~~~~~
Marlin\src\gcode\motion\../parser.h:302:35: note:   candidate expects 1 argument, 2 provided
*** [.pioenvs\LPC1768\src\src\gcode\motion\M290.o] Error 1
 [ERROR] Took 112.12 seconds
Confirmed ! Solved

All 8 comments

Hi, I just compiled branch version 94cb412 of Bugfix 2.0.x
I did not have any issue. It compiled ok.

Can you post your Configuration.h and Configuration_adv.h?

@coolio986 - Here my config files
Configuration.zip

The error is in M290.cpp

Line 63,31:
if (parser.boolval('P', true)) mod_zprobe_zoffset(offs);

Should be

if (parser.boolval('P')) mod_zprobe_zoffset(offs);

Since parser.boolval doesn't have a override for boolval(const char c, const bool b)

Also line 55,48:
if (a == Z_AXIS && parser.boolval('P', true)) mod_zprobe_zoffset(offs);

Should be

if (a == Z_AXIS && parser.boolval('P')) mod_zprobe_zoffset(offs);

got a similar error with bugfix-1.1.x:

Arduino: 1.8.1 (Mac OS X), Board: "Sanguino, ATmega1284 or ATmega1284P (16 MHz)"

sketch/Marlin_main.cpp: In function 'void gcode_M290()':
Marlin_main.cpp:9350: error: no matching function for call to 'GCodeParser::boolval(char, bool)'
if (parser.boolval('P', true)) mod_zprobe_zoffset(offs);
^
sketch/Marlin_main.cpp:9350:39: note: candidate is:
In file included from sketch/Marlin_main.cpp:260:0:
sketch/gcode.h:313:32: note: static bool GCodeParser::boolval(char)
FORCE_INLINE static bool boolval(const char c) { return seenval(c) ? value_bool() : seen(c); }
^
sketch/gcode.h:313:32: note: candidate expects 1 argument, 2 provided
exit status 1
no matching function for call to 'GCodeParser::boolval(char, bool)'

Same, as of latest bf2:

avr-g++ -o .pioenvs\teensy20\src\src\gcode\probe\G30.o -c -fno-exceptions -std=gnu++0x -felide-constructors -fno-threadsafe-statics -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=at90usb1286 -DF_CPU=16000000L -DLAYOUT_US_ENGLISH -DPLATFORMIO=30401 -DTEENSY2PP -DUSB_SERIAL -DARDUINO=10610 -DTEENSYDUINO=136 -I.pioenvs\teensy20\src -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\cores\teensy -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\cores -IMarlin -I.piolibdeps\U8glib-HAL_ID1932\src -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\Wire -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\Wire\utility -I.piolibdeps\LiquidCrystal_I2C_ID576 -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\SPI -I.piolibdeps\TMC2130Stepper\src "-I.piolibdeps\Adafruit NeoPixel" -I.piolibdeps\LiquidTWI2 -I.piolibdeps\TMC26XStepper -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\LiquidCrystal -IC:\users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\Servo Marlin\src\gcode\probe\G30.cpp
Marlin\src\gcode\motion\M290.cpp: In static member function 'static void GcodeSuite::M290()':
Marlin\src\gcode\motion\M290.cpp:63:37: error: no matching function for call to 'GCodeParser::boolval(char, int)'
if (parser.boolval('P', true)) mod_zprobe_zoffset(offs);
^
Marlin\src\gcode\motion\M290.cpp:63:37: note: candidate is:
In file included from Marlin\src\gcode\motion\../gcode.h:245:0,
from Marlin\src\gcode\motion\M290.cpp:27:
Marlin\src\gcode\motion\../parser.h:302:35: note: static bool GCodeParser::boolval(char)
FORCE_INLINE static bool        boolval(const char c)                          { return seenval(c) ? value_bool()         : seen(c); }
^
Marlin\src\gcode\motion\../parser.h:302:35: note:   candidate expects 1 argument, 2 provided
*** [.pioenvs\teensy20\src\src\gcode\motion\M290.o] Error 1

https://github.com/fiveangle/Marlin/tree/bf20-pb_simple_metal-2017-11-27

Haven't had time to dig into it yet.

-=dave

It appears that in gcode.h in #8016 & #8017 boolvalwas revised using inline if to return the default value from seen rather than injecting a bool into the function with a default value dval=false.

Some areas have not been fixed with the updated structure. Please fix 1.1.x (Marlin_main.cpp Line:9342,7)

Change this:


/**
   * M290: Babystepping
   */
  inline void gcode_M290() {
    #if ENABLED(BABYSTEP_XY)
      for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
        if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
          const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
          thermalManager.babystep_axis((AxisEnum)a, offs * planner.axis_steps_per_mm[a]);
          #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
            if (a == Z_AXIS && parser.boolval('P', true)) mod_zprobe_zoffset(offs);
          #endif
        }
    #else
      if (parser.seenval('Z') || parser.seenval('S')) {
        const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
        thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]);
        #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
          if (parser.boolval('P', true)) mod_zprobe_zoffset(offs);
        #endif
      }
    #endif
  }

To this:

/**
   * M290: Babystepping
   */
  inline void gcode_M290() {
    #if ENABLED(BABYSTEP_XY)
      for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
        if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
          const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
          thermalManager.babystep_axis((AxisEnum)a, offs * planner.axis_steps_per_mm[a]);
          #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
            if (a == Z_AXIS && parser.boolval('P')) mod_zprobe_zoffset(offs);
          #endif
        }
    #else
      if (parser.seenval('Z') || parser.seenval('S')) {
        const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
        thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]);
        #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
          if (parser.boolval('P')) mod_zprobe_zoffset(offs);
        #endif
      }
    #endif
  }

They were changed by Luc, but Scott accidentally introduced this regression by re-injecting the old method into M290 routines with https://github.com/MarlinFirmware/Marlin/commit/2060ba3556df97621eae8051845f1224f764cb82 (bf11) and https://github.com/MarlinFirmware/Marlin/commit/be00e421a76cc82a3e68cf801e211b0f450ea393 (bf20).

https://github.com/MarlinFirmware/Marlin/commit/4793c34c5365e7720c0a53c7bd88188aaf37f227#diff-0fd14a2c470111ee540fb05d44e1a9f1 resolves.

-=dave

Thanks the team. It compiles fine now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ciev picture Ciev  路  3Comments

spanner888 picture spanner888  路  4Comments

ShadowOfTheDamn picture ShadowOfTheDamn  路  3Comments

modem7 picture modem7  路  3Comments

ahsnuet09 picture ahsnuet09  路  3Comments