neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
933 stars 189 forks source link

Menu with struct #305

Closed fmatray closed 4 years ago

fmatray commented 4 years ago

Hello, I have a struct "config_t config" and I try to build a menu with elements inside and I get the error below. I tried to follow several example here, but I don't understand why I get this.

/Users/user/.platformio/lib/ArduinoMenu library_ID1468/src/menuIO/../macros.h:199:3: error: cannot convert 'int' to 'Menu::prompt' in initialization

typedef struct
{
   /* Time */
   char timezone_offset = +2;

   /* Ambiant */
   float temp_ambient_offset = 0;  // Adjust temperature offset
   float humid_ambient_offset = 0; // Adjust temperature offset
} config_t;

MENU(mainMenu, "Menu", Menu::doNothing, Menu::noEvent, Menu::wrapStyle,
     FIELD(config.timezone_offset, "Timezone", "h", -12, 12, 1, 0, Menu::doNothing, Menu::noEvent, Menu::noStyle),
     EXIT("<Back"));
fmatray commented 4 years ago

Found... there a confusion between my object config and Menu::config...