neu-rah / ArduinoMenu

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

Inconsistent navCode handling #371

Open regnaDkciN opened 2 years ago

regnaDkciN commented 2 years ago

menuBase.h line 195 defines navCode as follows: typedef navCode navCodesDef[10]; However, at line 98 of menuBase.h navCmds is defined with 11 entries. as follows: enum navCmds { noCmd=0, escCmd, enterCmd, upCmd, downCmd, leftCmd, rightCmd, idxCmd, selCmd, scrlUpCmd, scrlDownCmd };

Then in menuBase.cpp at line 38 we see the following: const navCodesDef Menu::defaultNavCodes={ {noCmd,(uint8_t)0xff}, {escCmd,'/'}, {enterCmd,'*'}, {upCmd,'+'}, {downCmd,'-'}, {leftCmd,'-'}, {rightCmd,'+'}, {idxCmd,'?'}, {scrlUpCmd,0x35}, {scrlUpCmd,0x36} };

This initialization does not match the enum at line 98 of menuBase.h.

I would suggest changing menuBase.cpp as follows: const navCodesDef Menu::defaultNavCodes={ {noCmd,(uint8_t)0xff}, {escCmd,'/'}, {enterCmd,'*'}, {upCmd,'+'}, {downCmd,'-'}, {leftCmd,'-'}, {rightCmd,'+'}, {idxCmd,'?'}, {selCmd,'s'}, {scrlUpCmd,'U'}, {scrlDownCmd,'D'} }; Then fix menuBase.h to match the 11 entries of navCodeDef.