From: Marcus M. <cod...@gm...> - 2015-11-01 17:51:50
|
Hello, let me offer some new features (diff file attached) for LCD4Linux. Table of content: 1. Summary 2. New plugins / drivers 2.1 Plugin Layout 2.2 Plugin Menu 2.3 Plugin Control 2.4 Plugin Run 2.5 Plugin List 2.6 Driver FutabaVFD 3. Comments on the diff file 4. Open issues 4.1 Wiki 4.2 External Controller 4.3 Init and coupling of plugin Layout & Menu: 4.4 Limited widget number 4.5 Test and code review 1. Summary ========== The modifications (status: proof of concept) are mainly written to achive the following goals: 1. switch layouts while runtime 2. create menu controls 3. enable external controls like buttons, scripts, LED 4. start external scripts menu controlled Most of these features are encapsulated in plugins. So the use is optional and the risk of screwing up running code is lower. But some fixes and modifications on the existing sources had to be done too (see 3.). 2. New plugins /drivers ======================= A wiki entry was created for each new plugin. But these entries have not been linked in the plugin summary entry yet. CAUTION: Since I wasn't able to modify wiki attachments some of the older ones may contain erros. So please don't use attachments that were not linked in the text of the wiki entry. 2.1 Plugin Layout ----------------- See: https://lcd4linux.bulix.org/wiki/plugin_layout The Plugin "Layout" makes it possible to switch between different layouts while runtime and create simple menus. The switching may be triggered by the Timer Widget, Keypad Widget or external controllers by using the Control plugin (2.3). 2.2 Plugin Menu --------------- See: https://lcd4linux.bulix.org/wiki/plugin_menu The plugin Menu allows to configure and use more complex menus. 2.3 Plugin Control ------------------ See: https://lcd4linux.bulix.org/wiki/plugin_control The Plugin Control makes it possible to use inputs (buttons, FIFOs, ...) and outputs (LED, ...) of different resources (usb mouse, serial port, ...) within LCD4Linux. External executables (controllers) are started to control these resources. Some example programs (serial port, usb mouse, fifo) are linked in the wiki entry. 2.4 Plugin Run --------------- See: https://lcd4linux.bulix.org/wiki/plugin_run Plugin Run supplies a way to start & kill executables. 2.5 Plugin List --------------- See: https://lcd4linux.bulix.org/wiki/plugin_list Plugin List allows to configure lists that can be modified while runtime. This can be used to make selections or log entries. 2.6 FutabaVFD ------------- See: https://lcd4linux.bulix.org/wiki/FutabaVFD The driver is not new but was rebuilt nearly from scratch. A wiki entry was added. 3. Comments on the diff file ============================ action.c/h: Actions are used by the plugins Layout and Menu and by the Futaba driver. Have a look at the wiki entries. cfg.c/h: Three functions were added to make the reading od the config more easy. drv_Curses.c: The function 'strpbrk' can't be used here because 'data' is NOT a '\0' terminated string. drv_FutabaVFD.c: rebuilt driver drv_generic_parport.c/h: The added fuction drv_generic_parport_hardwire_status is used by the FutabaVFD driver. drv_generic_text.c/h: A function to clear the display was added. (switch layouts) evaluator.c: Avoid a memory leak. plugin_control.c, plugin_layout.c, plugin_list.c, plugin_menu.c, plugin_run.c: new plugins plugin_math.c: Random function added. (nice for testing) plugin_string.c: Function 'charset' added to provide a easy way to show display specific chars. timer.c/h: typedef moved to header because type is used in plugin_layout.c too. 1 bug fixed. timer_group.c/h: Typedef moved to header because type is used in plugin_layout.c too. 1 bug fixed. widget_image.c: Function 'widget_image_update' was set non static to be useable in plugin_layout.c. widget_keypad.c: Avoid memory leaks. 4. Open issues ============== 4.1 Wiki -------- As mentioned above (2.) I've seen no way to remove/modify faulty wiki attachments. Wiki entries have been created. Modifications to be done after the code changes are checked in: - summary displays (FutabaVFD) - summary plugins (Control, Layout, List, Menu, Run) - update Math (rand) and String (charset) plugin entries 4.2 External Controller ----------------------- Since the Control plugin makes use of external programs (see wiki) it has to be decided how to provide this programs. (Subfolder in lcd4linux vs. external project - e.g. github) At the moment the three controllers which were made for testing or personal use are provided via github and discribed in the LCD4Linux wiki. (For links see 2.3) 4.3 Init and coupling of plugin Layout & Menu: ---------------------------------------------- Plugins are initiated before widget classes. But during the init of plugin Layout this widget classes are needed. So the init of plugin layout is done later by a timer callback. Plugin Menu depends on plugin Layout. So its init will be called from plugin Layout a second time (real init). Beside this the two plugins call functions of each other (not loosely coupled). 4.4 Limited widget number ------------------------- The maximum number of widgets is set to 256 (MAX_WIDGETS in widget.c). This might get a problem with big menues and multiple layouts. (Using some widgets in multiple layouts won't help because such a widget will be stored multiple times.) 4.5 Test and code review ------------------------ The plugins has been tested in text mode with the displays Curses and FutabaVFD. They should be tested with graphical displays, user defined chars, icons, images and layer too. Code reviews and comments are greatly appreciated. Thanks for reading. Regards Marcus Menzel |