New touchscreen scaling algorithm for the case where measured X values vary with y position (and vice versa)
This commit is contained in:
parent
07d226c8c5
commit
8b207726d3
@ -395,4 +395,6 @@
|
||||
* NxWidgets/libnxwidgets/src/glyph_nxlogo320x320.cxx: Add a big, 320x320
|
||||
NuttX logo image. The older, smaller NuttX logo was renamed from
|
||||
nxlogo to nxlogo160x160 in all places (2015-10-15).
|
||||
|
||||
* NxWM::CCalibration and NxWM::CTouchscreen: Add a complex touchscreen
|
||||
scaling algorithm to handling the case where the measured X values also
|
||||
vary with y position (and vice versa) (2013-10-17).
|
||||
|
188
Kconfig
188
Kconfig
@ -11,7 +11,8 @@ config NXWIDGETS
|
||||
Enable support for NxWidgets
|
||||
|
||||
if NXWIDGETS
|
||||
comment "NX Server/Device Configuration"
|
||||
|
||||
menu "NX Server/Device Configuration"
|
||||
|
||||
config NXWIDGETS_FLICKERFREE
|
||||
bool "Enable Flicker Reduction Logic"
|
||||
@ -91,7 +92,9 @@ config NXWIDGET_EVENTWAIT
|
||||
so that looping logic can sleep until something interesting happens
|
||||
with the window.
|
||||
|
||||
comment "NXWidget Configuration"
|
||||
endmenu # NX Server/Device Configuration
|
||||
|
||||
menu "NXWidget Configuration"
|
||||
|
||||
config NXWIDGETS_BPP
|
||||
int "BPP"
|
||||
@ -115,13 +118,15 @@ config NXWIDGETS_SYSTEM_CUSTOM_FONTID
|
||||
Set to override the system default font id (NXFONT_DEFAULT).
|
||||
|
||||
if NXWIDGETS_SYSTEM_CUSTOM_FONTID
|
||||
|
||||
config NXWIDGETS_DEFAULT_FONTID
|
||||
int "Default Font ID"
|
||||
default 0
|
||||
---help---
|
||||
Use this default NxWidgets font ID instead of the system font ID
|
||||
(NXFONT_DEFAULT). Default: 0
|
||||
endif
|
||||
|
||||
endif # NXWIDGETS_SYSTEM_CUSTOM_FONTID
|
||||
|
||||
config NXWIDGETS_TNXARRAY_INITIALSIZE
|
||||
int "Initial Size of Dynamic Arrays"
|
||||
@ -145,6 +150,7 @@ config NXWIDGETS_CUSTOM_FILLCOLORS
|
||||
of the default colors depend on the pixel depth). Default: n
|
||||
|
||||
if NXWIDGETS_CUSTOM_FILLCOLORS
|
||||
|
||||
config NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||
hex "Default Normal Background Color"
|
||||
---help---
|
||||
@ -160,7 +166,8 @@ config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR
|
||||
---help---
|
||||
Highlight color. Currently this color is only used in clist
|
||||
boxes, progress bars, and slider grips. Default: RGB(192,192,192)
|
||||
endif
|
||||
|
||||
endif # NXWIDGETS_CUSTOM_FILLCOLORS
|
||||
|
||||
config NXWIDGETS_CUSTOM_EDGECOLORS
|
||||
bool "Custom Default Edge Colors"
|
||||
@ -172,6 +179,7 @@ config NXWIDGETS_CUSTOM_EDGECOLORS
|
||||
of the default colors depend on the pixel depth). Default: n.
|
||||
|
||||
if NXWIDGETS_CUSTOM_EDGECOLORS
|
||||
|
||||
config NXWIDGETS_DEFAULT_SHINEEDGECOLOR
|
||||
hex "Default Shiny Edge Color"
|
||||
---help---
|
||||
@ -181,7 +189,8 @@ config NXWIDGETS_DEFAULT_SHADOWEDGECOLOR
|
||||
hex "Default Shadow Edge Color"
|
||||
---help---
|
||||
Shadowed side border color. Default: RGB(35,58,73)
|
||||
endif
|
||||
|
||||
endif # NXWIDGETS_CUSTOM_EDGECOLORS
|
||||
|
||||
config NXWIDGETS_CUSTOM_TEXTCOLORS
|
||||
bool "Custom Default Text colors"
|
||||
@ -193,6 +202,7 @@ config NXWIDGETS_CUSTOM_TEXTCOLORS
|
||||
of the default colors depend on the pixel depth). Default: n.
|
||||
|
||||
if NXWIDGETS_CUSTOM_TEXTCOLORS
|
||||
|
||||
config NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR
|
||||
hex "Default Disabled Text Color"
|
||||
---help---
|
||||
@ -212,7 +222,8 @@ config NXWIDGETS_DEFAULT_FONTCOLOR
|
||||
hex "Default Default Font Color"
|
||||
---help---
|
||||
Default font color. Default: RGB(255,255,255)
|
||||
endif
|
||||
|
||||
endif # NXWIDGETS_CUSTOM_TEXTCOLORS
|
||||
|
||||
config NXWIDGETS_TRANSPARENT_COLOR
|
||||
hex "Transparent Color"
|
||||
@ -265,7 +276,8 @@ config NXWIDGET_MEMMONITOR
|
||||
Enable memory usage monitor instrumentation. This feature is only
|
||||
used by the NxWidget/NxWM unit tests.
|
||||
|
||||
endif
|
||||
endmenu # NXWidget Configuration
|
||||
endif # NxWidgets
|
||||
|
||||
config NXWM
|
||||
bool "Enable NxWM"
|
||||
@ -275,7 +287,8 @@ config NXWM
|
||||
Enable support for the NuttX Tiny Window Manager (NxWM)
|
||||
|
||||
if NXWM
|
||||
comment "General settings"
|
||||
|
||||
menu "NxWM General settings"
|
||||
|
||||
config NXWM_SYSTEM_CUSTOM_FONTID
|
||||
bool "Use Custom Default Font"
|
||||
@ -284,13 +297,15 @@ config NXWM_SYSTEM_CUSTOM_FONTID
|
||||
Set to override the system default font id (NXFONT_DEFAULT).
|
||||
|
||||
if NXWM_SYSTEM_CUSTOM_FONTID
|
||||
|
||||
config NXWM_DEFAULT_FONTID
|
||||
int "Font ID"
|
||||
default 0
|
||||
---help---
|
||||
Use this NxWM default font ID instead of the system font ID
|
||||
(NXFONT_DEFAULT). Default: 0
|
||||
endif
|
||||
|
||||
endif # NXWM_SYSTEM_CUSTOM_FONTID
|
||||
|
||||
config NXWM_UNITTEST
|
||||
bool "NxWM Unit Test"
|
||||
@ -310,6 +325,7 @@ config NXWM_CUSTOM_FILLCOLORS
|
||||
of the default colors depend on the pixel depth). Default: n
|
||||
|
||||
if NXWM_CUSTOM_FILLCOLORS
|
||||
|
||||
config NXWM_DEFAULT_BACKGROUNDCOLOR
|
||||
hex "Background Color"
|
||||
---help---
|
||||
@ -319,7 +335,8 @@ config NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR
|
||||
hex "Normal Background Color"
|
||||
---help---
|
||||
Select background color. Default: RGB(206,227,241)
|
||||
endif
|
||||
|
||||
endif # NXWM_DEFAULT_BACKGROUNDCOLOR
|
||||
|
||||
config NXWM_CUSTOM_EDGECOLORS
|
||||
bool "Custom Default Edge Colors"
|
||||
@ -331,6 +348,7 @@ config NXWM_CUSTOM_EDGECOLORS
|
||||
of the default colors depend on the pixel depth). Default: n.
|
||||
|
||||
if NXWM_CUSTOM_EDGECOLORS
|
||||
|
||||
config NXWM_DEFAULT_SHINEEDGECOLOR
|
||||
hex "Shiny Edge Color"
|
||||
---help---
|
||||
@ -340,7 +358,8 @@ config NXWM_DEFAULT_SHADOWEDGECOLOR
|
||||
hex "Shadow Edge Color"
|
||||
---help---
|
||||
Color of the shadowed edge of a border. Default: RGB(0,0,0)
|
||||
endif
|
||||
|
||||
endif # NXWM_CUSTOM_EDGECOLORS
|
||||
|
||||
config NXWM_CUSTOM_TEXTCOLORS
|
||||
bool "Custom Default Text colors"
|
||||
@ -352,6 +371,7 @@ config NXWM_CUSTOM_TEXTCOLORS
|
||||
of the default colors depend on the pixel depth). Default: n.
|
||||
|
||||
if NXWM_CUSTOM_TEXTCOLORS
|
||||
|
||||
config NXWM_DEFAULT_FONTCOLOR
|
||||
hex "Default Font Color"
|
||||
---help---
|
||||
@ -362,8 +382,29 @@ config NXWM_TRANSPARENT_COLOR
|
||||
default 0x0
|
||||
---help---
|
||||
The "transparent" color. Default: RGB(0,0,0)
|
||||
endif
|
||||
|
||||
endif # NXWM_CUSTOM_TEXTCOLORS
|
||||
|
||||
comment "Background Image"
|
||||
|
||||
config NXWM_DISABLE_BACKGROUND_IMAGE
|
||||
bool "Disable Background Image"
|
||||
default n if !NXWM_DISABLE_MINIMIZE
|
||||
default y if NXWM_DISABLE_MINIMIZE
|
||||
---help---
|
||||
Disable support for the "Desktop" background image.
|
||||
|
||||
config NXWM_BACKGROUND_IMAGE
|
||||
string "Background Image"
|
||||
default "NXWidgets::g_nuttxBitmap160x160"
|
||||
depends on !NXWM_DISABLE_BACKGROUND_IMAGE
|
||||
---help---
|
||||
The name of the image to use in the background window. Default:
|
||||
"NXWidgets::g_nuttxBitmap160x160"
|
||||
|
||||
endmenu # NxWM General Configuration
|
||||
|
||||
menu "NxWM Taskbar Configuration"
|
||||
comment "Horizontal and vertical spacing of icons in the task bar"
|
||||
|
||||
config NXWM_TASKBAR_VSPACING
|
||||
@ -413,12 +454,14 @@ config NXWM_CUSTOM_TASKBAR_WIDTH
|
||||
vertical spacing. Default: 25 + 2*spacing
|
||||
|
||||
if NXWM_CUSTOM_TASKBAR_WIDTH
|
||||
|
||||
config NXWM_TASKBAR_WIDTH
|
||||
int "Taskbar Width"
|
||||
default 29
|
||||
---help---
|
||||
Task bar thickness (either vertical or horizontal). Default: 25 + 2*2
|
||||
endif
|
||||
|
||||
endif # NXWM_CUSTOM_TASKBAR_WIDTH
|
||||
|
||||
config NXWM_TASKBAR_ICONSCALE
|
||||
bool "Scale Icons"
|
||||
@ -440,7 +483,7 @@ config NXWM_TASKBAR_ICONHEIGHT
|
||||
---help---
|
||||
Scaled height of each taskbar ICON in pixels.
|
||||
|
||||
endif #NXWM_TASKBAR_ICONSCALE
|
||||
endif # NXWM_TASKBAR_ICONSCALE
|
||||
|
||||
config NXWM_DISABLE_MINIMIZE
|
||||
bool "Disable Minimize Button"
|
||||
@ -456,7 +499,9 @@ config NXWM_TASKBAR_NO_BORDER
|
||||
---help---
|
||||
Suppress drawing a the border around the taskbar.
|
||||
|
||||
comment "Tool Bar Configuration"
|
||||
endmenu # NxWM Taskbar Configuration
|
||||
|
||||
menu "NxWM Toolbar Configuration"
|
||||
|
||||
config NXWM_CUSTOM_TOOLBAR_HEIGHT
|
||||
bool "Use Custom Toolbar Height"
|
||||
@ -466,6 +511,7 @@ config NXWM_CUSTOM_TOOLBAR_HEIGHT
|
||||
the selected horizontal or vertical spacing. Default: 21 + 2*spacing
|
||||
|
||||
if NXWM_CUSTOM_TOOLBAR_HEIGHT
|
||||
|
||||
config NXWM_TOOLBAR_HEIGHT
|
||||
int "Toolbar Height"
|
||||
default 25
|
||||
@ -473,26 +519,11 @@ config NXWM_TOOLBAR_HEIGHT
|
||||
The height of the tool bar in each application window. At present,
|
||||
all icons are 21 pixels in height and, hence, require a task bar of
|
||||
at least that size. Default: 21 + 2*2
|
||||
endif
|
||||
|
||||
comment "Background Image"
|
||||
endif # NXWM_CUSTOM_TOOLBAR_HEIGHT
|
||||
endmenu # NxWM Toolbar Configuration
|
||||
|
||||
config NXWM_DISABLE_BACKGROUND_IMAGE
|
||||
bool "Disable Background Image"
|
||||
default n if !NXWM_DISABLE_MINIMIZE
|
||||
default y if NXWM_DISABLE_MINIMIZE
|
||||
---help---
|
||||
Disable support for the "Desktop" background image.
|
||||
|
||||
config NXWM_BACKGROUND_IMAGE
|
||||
string "Background Image"
|
||||
default "NXWidgets::g_nuttxBitmap160x160"
|
||||
depends on !NXWM_DISABLE_BACKGROUND_IMAGE
|
||||
---help---
|
||||
The name of the image to use in the background window. Default:
|
||||
"NXWidgets::g_nuttxBitmap160x160"
|
||||
|
||||
comment "Application Window Configuration"
|
||||
menu "NxWM Application Window Configuration"
|
||||
|
||||
config NXWM_CUSTOM_APPWINDOW_ICONS
|
||||
bool "Custom Start/Stop Application Window Icons"
|
||||
@ -514,10 +545,10 @@ config NXWM_MINIMIZE_BITMAP
|
||||
---help---
|
||||
The glyph to use as the Minimize icon. Default: NxWM::g_minimizeBitmap
|
||||
|
||||
endif
|
||||
|
||||
comment "Start Window Configuration"
|
||||
endif # NXWM_CUSTOM_APPWINDOW_ICONS
|
||||
endmenu # NxWM Application Window Configuration
|
||||
|
||||
menu "NxWM Start Window Configuration"
|
||||
comment "Horizontal and vertical spacing of icons in the task bar"
|
||||
|
||||
config NXWM_STARTWINDOW_VSPACING
|
||||
@ -539,12 +570,14 @@ config NXWM_CUSTOM_STARTWINDOW_ICON
|
||||
Select to override the default Start Window Icon: NxWM::g_playBitmap
|
||||
|
||||
if NXWM_CUSTOM_STARTWINDOW_ICON
|
||||
|
||||
config NXWM_STARTWINDOW_ICON
|
||||
string "StartWindow Icon"
|
||||
default "NxWM::g_playBitmap"
|
||||
---help---
|
||||
The glyph to use as the start window icon. Default: NxWM::g_playBitmap
|
||||
endif
|
||||
|
||||
endif # NXWM_CUSTOM_STARTWINDOW_ICON
|
||||
|
||||
config NXWM_STARTWINDOW_MQNAME
|
||||
string "Message Queue Name"
|
||||
@ -582,7 +615,9 @@ config NXWM_STARTWINDOW_STACKSIZE
|
||||
The stack size to use when starting the StartWindow task. Default:
|
||||
2048 bytes.
|
||||
|
||||
comment "NxConsole Window Configuration"
|
||||
endmenu # Start Window Configuration
|
||||
|
||||
menu "NxConsole Window Configuration"
|
||||
|
||||
config NXWM_NXCONSOLE_PRIO
|
||||
int "NxConsole Task Priority"
|
||||
@ -611,6 +646,7 @@ config NXWM_NXCONSOLE_CUSTOM_COLORS
|
||||
of the default colors depend on the pixel depth). Default: n
|
||||
|
||||
if NXWM_NXCONSOLE_CUSTOM_COLORS
|
||||
|
||||
config NXWM_NXCONSOLE_WCOLOR
|
||||
hex "NxConsole Background Color"
|
||||
---help---
|
||||
@ -622,7 +658,8 @@ config NXWM_NXCONSOLE_FONTCOLOR
|
||||
---help---
|
||||
The color of the fonts to use in the NxConsole window.
|
||||
Default: RGB(0,0,0)
|
||||
endif
|
||||
|
||||
endif # NXWM_NXCONSOLE_CUSTOM_COLORS
|
||||
|
||||
config NXWM_NXCONSOLE_CUSTOM_FONTID
|
||||
bool "Use Custom Default Font"
|
||||
@ -631,13 +668,15 @@ config NXWM_NXCONSOLE_CUSTOM_FONTID
|
||||
Set to override the system default font id (NXWM_DEFAULT_FONTID).
|
||||
|
||||
if NXWM_NXCONSOLE_CUSTOM_FONTID
|
||||
|
||||
config NXWM_NXCONSOLE_FONTID
|
||||
int "NxConsole Font ID"
|
||||
default 0
|
||||
---help---
|
||||
Use this default font ID in the NxConsole window instead of the
|
||||
NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0
|
||||
endif
|
||||
|
||||
endif # NXWM_NXCONSOLE_CUSTOM_FONTID
|
||||
|
||||
config NXWM_CUSTOM_NXCONSOLE_ICON
|
||||
bool "Custom NxConsole Icon"
|
||||
@ -646,12 +685,18 @@ config NXWM_CUSTOM_NXCONSOLE_ICON
|
||||
Select to override the default NxConsole Window Icon: NxWM::g_cmdBitmap
|
||||
|
||||
if NXWM_CUSTOM_NXCONSOLE_ICON
|
||||
|
||||
config NXWM_NXCONSOLE_ICON
|
||||
string "NxConsole Icon"
|
||||
default "NxWM::g_cmdBitmap"
|
||||
---help---
|
||||
The glyph to use as the NxConsole icon. Default: NxWM::g_cmdBitmap
|
||||
endif
|
||||
|
||||
endif # NXWM_NXCONSOLE_ICON
|
||||
|
||||
endmenu # NxConsole Window Configuration
|
||||
|
||||
menu "NxWM Touchscreen Configuration"
|
||||
|
||||
config NXWM_TOUCHSCREEN
|
||||
bool "Touchscreen Support"
|
||||
@ -661,6 +706,7 @@ config NXWM_TOUCHSCREEN
|
||||
Define to build in touchscreen support.
|
||||
|
||||
if NXWM_TOUCHSCREEN
|
||||
|
||||
comment "Touchscreen device settings"
|
||||
|
||||
config NXWM_TOUCHSCREEN_DEVNO
|
||||
@ -695,7 +741,10 @@ config NXWM_TOUCHSCREEN_LISTENERSTACK
|
||||
---help---
|
||||
Touchscreen listener thread stack size. Default 1024
|
||||
|
||||
endif
|
||||
endif # NXWM_TOUCHSCREEN
|
||||
endmenu # NxWM Touchscreen Configuration
|
||||
|
||||
menu "NxWM Keyboard Configuration"
|
||||
|
||||
config NXWM_KEYBOARD
|
||||
bool "Keyboard Support"
|
||||
@ -704,6 +753,7 @@ config NXWM_KEYBOARD
|
||||
Define to build in touchscreen support.
|
||||
|
||||
if NXWM_KEYBOARD
|
||||
|
||||
comment "Keyboard device settings"
|
||||
|
||||
config NXWM_KEYBOARD_DEVPATH
|
||||
@ -737,9 +787,10 @@ config NXWM_KEYBOARD_LISTENERSTACK
|
||||
---help---
|
||||
Keyboard listener thread stack size. Default: 1024
|
||||
|
||||
endif
|
||||
endif # NXWM_KEYBOARD
|
||||
endmenu # NxWM Keyboard Configuration
|
||||
|
||||
comment "Calibration display settings"
|
||||
menu "NxWM Calibration display settings"
|
||||
|
||||
config NXWM_CALIBRATION_MARGIN
|
||||
int "Calibration Margin"
|
||||
@ -763,6 +814,7 @@ config NXWM_CALIBRATION_CUSTOM_COLORS
|
||||
on the pixel depth). Default: n
|
||||
|
||||
if NXWM_CALIBRATION_CUSTOM_COLORS
|
||||
|
||||
config NXWM_CALIBRATION_BACKGROUNDCOLOR
|
||||
hex "Background Color"
|
||||
---help---
|
||||
@ -786,7 +838,8 @@ config NXWM_CALIBRATION_TOUCHEDCOLOR
|
||||
---help---
|
||||
The color of the circle in the touchscreen calibration display after
|
||||
the touch is recorder. Default: RGB(255, 255, 96) (very light yellow)
|
||||
endif
|
||||
|
||||
endif # NXWM_CALIBRATION_CUSTOM_COLORS
|
||||
|
||||
config NXWM_CALIBRATION_MESSAGES
|
||||
bool "Add Instructions in Center"
|
||||
@ -845,6 +898,26 @@ config NXWM_CALIBRATION_DISCARD_MINMAX
|
||||
endif # NXWM_CALIBRATION_AVERAGE
|
||||
endif # NXWM_CALIBRATION_MESSAGES
|
||||
|
||||
config NXWM_CALIBRATION_ANISOTROPIC
|
||||
bool "Anisotropic Scaling"
|
||||
default n
|
||||
---help---
|
||||
Most touchscreens have the property that the X value consistent across
|
||||
the entire vertial range of the display, i.e., if you press in the
|
||||
upper left of the display and in the low right of the display, then
|
||||
only the Y value will change. This is true of some touchscreens:
|
||||
For some touchscreens the X values in the same vertical column will
|
||||
change as the Y values change. Here I use the term anisotropic to
|
||||
describe that (that is not really the correct use of term term, but
|
||||
I have not yet thought of a better name).
|
||||
|
||||
If you have such an LCD, then you may select this option to enable
|
||||
some much more complex scaling alorithms to handle this case. Not
|
||||
only are these algorithms more complex, but they are (currenly)
|
||||
implemented using floating point. As a result, you should not select
|
||||
this option if you have a lower end MCU without hardware floating
|
||||
point support.
|
||||
|
||||
config NXWM_CUSTOM_CALIBRATION_ICON
|
||||
bool "Custom Calibration Icon"
|
||||
default n
|
||||
@ -853,13 +926,15 @@ config NXWM_CUSTOM_CALIBRATION_ICON
|
||||
NxWM::g_calibrationBitmap
|
||||
|
||||
if NXWM_CUSTOM_CALIBRATION_ICON
|
||||
|
||||
config NXWM_CALIBRATION_ICON
|
||||
string "Callibration Icon"
|
||||
default "NxWM::g_calibrationBitmap"
|
||||
---help---
|
||||
The ICON to use for the touchscreen calibration application. Default:
|
||||
NxWM::g_calibrationBitmap
|
||||
endif
|
||||
|
||||
endif # NXWM_CUSTOM_CALIBRATION_ICON
|
||||
|
||||
config NXWM_CALIBRATION_SIGNO
|
||||
int "Calibration Signal Number"
|
||||
@ -880,7 +955,9 @@ config NXWM_CALIBRATION_LISTENERSTACK
|
||||
---help---
|
||||
Calibration listener thread stack size. Default 2048
|
||||
|
||||
comment "Hex Calculator display settings"
|
||||
endmenu # NxWM Calibration display settings
|
||||
|
||||
menu "NxWM Hex Calculator display settings"
|
||||
|
||||
config NXWM_HEXCALCULATOR_CUSTOM_COLORS
|
||||
bool "Custom Hex Calculator Colors"
|
||||
@ -893,12 +970,14 @@ config NXWM_HEXCALCULATOR_CUSTOM_COLORS
|
||||
pixel depth). Default: n
|
||||
|
||||
if NXWM_HEXCALCULATOR_CUSTOM_COLORS
|
||||
|
||||
config NXWM_HEXCALCULATOR_BACKGROUNDCOLOR
|
||||
hex "Calculator Background Color"
|
||||
---help---
|
||||
The background color of the calculator display. Default: Same
|
||||
as NXWM_DEFAULT_BACKGROUNDCOLOR
|
||||
endif
|
||||
|
||||
endif # NXWM_HEXCALCULATOR_CUSTOM_COLORS
|
||||
|
||||
config NXWM_CUSTOM_HEXCALCULATOR_ICON
|
||||
bool "Custom Hex Calculator Icon"
|
||||
@ -908,13 +987,15 @@ config NXWM_CUSTOM_HEXCALCULATOR_ICON
|
||||
NxWM::g_calculatorBitmap
|
||||
|
||||
if NXWM_CUSTOM_HEXCALCULATOR_ICON
|
||||
|
||||
config NXWM_HEXCALCULATOR_ICON
|
||||
string "Calculator Icon"
|
||||
default "NxWM::g_calculatorBitmap"
|
||||
---help---
|
||||
The ICON to use for the hex calculator application. Default:
|
||||
"NxWM::g_calculatorBitmap"
|
||||
endif
|
||||
|
||||
endif # NXWM_CUSTOM_HEXCALCULATOR_ICON
|
||||
|
||||
config NXWM_HEXCALCULATOR_CUSTOM_FONTID
|
||||
bool "Use Custom Default Font"
|
||||
@ -923,16 +1004,19 @@ config NXWM_HEXCALCULATOR_CUSTOM_FONTID
|
||||
Set to override the system default font id (NXWM_DEFAULT_FONTID).
|
||||
|
||||
if NXWM_HEXCALCULATOR_CUSTOM_FONTID
|
||||
|
||||
config NXWM_HEXCALCULATOR_FONTID
|
||||
int "Calculator Font ID"
|
||||
default 0
|
||||
---help---
|
||||
Use this default font ID in the calculator window instead of the
|
||||
NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0
|
||||
endif
|
||||
|
||||
endif # NXWM_HEXCALCULATOR_FONTID
|
||||
endmenu # NxWM Hex Calculator display settings
|
||||
|
||||
config NXWM_MEDIAPLAYER
|
||||
bool "Enable Media Player"
|
||||
bool "Enable NxWM Media Player"
|
||||
default n
|
||||
---help---
|
||||
Enable support for the MP3 Media Player. This features requires
|
||||
@ -943,4 +1027,4 @@ config NXWM_MEDIAPLAYER
|
||||
NOTE: This application is currently under development and just
|
||||
a shell of an app which will be developed soon.
|
||||
|
||||
endif
|
||||
endif # NXWM
|
||||
|
@ -85,14 +85,36 @@ namespace NxWM
|
||||
* Touchscreen calibration data
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NXWM_CALIBRATION_ANISOTROPIC
|
||||
struct SCalibrationLine
|
||||
{
|
||||
float slope; /**< The slope of a line */
|
||||
float offset; /**< The offset of a line */
|
||||
};
|
||||
|
||||
struct SCalibrationData
|
||||
{
|
||||
b16_t xSlope; // X conversion: xSlope*(x) + xOffset
|
||||
struct SCalibrationLine left; /**< Describes Y values along left edge */
|
||||
struct SCalibrationLine right; /**< Describes Y values along right edge */
|
||||
struct SCalibrationLine top; /**< Describes X values along top */
|
||||
struct SCalibrationLine bottom; /**< Describes X values along bottom edge */
|
||||
nxgl_coord_t leftX; /**< Left X value used in calibration */
|
||||
nxgl_coord_t rightX; /**< Right X value used in calibration */
|
||||
nxgl_coord_t topY; /**< Top Y value used in calibration */
|
||||
nxgl_coord_t bottomY; /**< Bottom Y value used in calibration */
|
||||
};
|
||||
|
||||
#else
|
||||
struct SCalibrationData
|
||||
{
|
||||
b16_t xSlope; /**< X conversion: xSlope*(x) + xOffset */
|
||||
b16_t xOffset;
|
||||
b16_t ySlope; // Y conversion: ySlope*(y) + yOffset
|
||||
b16_t ySlope; /**< Y conversion: ySlope*(y) + yOffset */
|
||||
b16_t yOffset;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The CCalibration class provides the the calibration window and obtains
|
||||
* callibration data.
|
||||
|
@ -1128,6 +1128,72 @@ bool CCalibration::createCalibrationData(struct SCalibrationData &data)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NXWM_CALIBRATION_ANISOTROPIC
|
||||
// X lines:
|
||||
//
|
||||
// x2 = slope*y1 + offset
|
||||
//
|
||||
// slope = (bottomY - topY) / (bottomX - topX)
|
||||
// offset = (topY - topX * slope)
|
||||
|
||||
float topX = (float)m_calibData[CALIB_UPPER_LEFT_INDEX].x;
|
||||
float bottomX = (float)m_calibData[CALIB_LOWER_LEFT_INDEX].x;
|
||||
|
||||
float topY = (float)m_calibData[CALIB_UPPER_LEFT_INDEX].y;
|
||||
float bottomY = (float)m_calibData[CALIB_LOWER_LEFT_INDEX].y;
|
||||
|
||||
data.left.slope = (bottomX - topX) / (bottomY - topY);
|
||||
data.left.offset = topX - topY * data.left.slope;
|
||||
|
||||
gdbg("Left slope: %f offset: %f\n", data.left.slope, data.left.offset);
|
||||
|
||||
topX = (float)m_calibData[CALIB_UPPER_RIGHT_INDEX].x;
|
||||
bottomX = (float)m_calibData[CALIB_LOWER_RIGHT_INDEX].x;
|
||||
|
||||
topY = (float)m_calibData[CALIB_UPPER_RIGHT_INDEX].y;
|
||||
bottomY = (float)m_calibData[CALIB_LOWER_RIGHT_INDEX].y;
|
||||
|
||||
data.right.slope = (bottomX - topX) / (bottomY - topY);
|
||||
data.right.offset = topX - topY * data.right.slope;
|
||||
|
||||
gdbg("Right slope: %f offset: %f\n", data.right.slope, data.right.offset);
|
||||
|
||||
// Y lines:
|
||||
//
|
||||
// y2 = slope*x1 + offset
|
||||
//
|
||||
// slope = (rightX - topX) / (rightY - leftY)
|
||||
// offset = (topX - leftY * slope)
|
||||
|
||||
float leftX = (float)m_calibData[CALIB_UPPER_LEFT_INDEX].x;
|
||||
float rightX = (float)m_calibData[CALIB_UPPER_RIGHT_INDEX].x;
|
||||
|
||||
float leftY = (float)m_calibData[CALIB_UPPER_LEFT_INDEX].y;
|
||||
float rightY = (float)m_calibData[CALIB_UPPER_RIGHT_INDEX].y;
|
||||
|
||||
data.top.slope = (rightY - leftY) / (rightX - leftX);
|
||||
data.top.offset = leftY - leftX * data.top.slope;
|
||||
|
||||
gdbg("Top slope: %f offset: %f\n", data.top.slope, data.top.offset);
|
||||
|
||||
leftX = (float)m_calibData[CALIB_LOWER_LEFT_INDEX].x;
|
||||
rightX = (float)m_calibData[CALIB_LOWER_RIGHT_INDEX].x;
|
||||
|
||||
leftY = (float)m_calibData[CALIB_LOWER_LEFT_INDEX].y;
|
||||
rightY = (float)m_calibData[CALIB_LOWER_RIGHT_INDEX].y;
|
||||
|
||||
data.bottom.slope = (rightY - leftY) / (rightX - leftX);
|
||||
data.bottom.offset = leftY - leftX * data.bottom.slope;
|
||||
|
||||
gdbg("Bottom slope: %f offset: %f\n", data.bottom.slope, data.bottom.offset);
|
||||
|
||||
// Save also the calibration screen positions
|
||||
|
||||
data.leftX = CALIBRATION_LEFTX;
|
||||
data.rightX = CALIBRATION_RIGHTX;
|
||||
data.topY = CALIBRATION_TOPY;
|
||||
data.bottomY = CALIBRATION_BOTTOMY;
|
||||
#else
|
||||
// Calculate the calibration parameters
|
||||
//
|
||||
// (scaledX - LEFTX) / (rawX - leftX) = (RIGHTX - LEFTX) / (rightX - leftX)
|
||||
@ -1169,6 +1235,8 @@ bool CCalibration::createCalibrationData(struct SCalibrationData &data)
|
||||
data.yOffset = itob16(CALIBRATION_TOPY) - b16mulb16(topY, data.ySlope);
|
||||
|
||||
gdbg("New ySlope: %08x yOffset: %08x\n", data.ySlope, data.yOffset);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -472,6 +472,66 @@ void CTouchscreen::handleMouseInput(struct touch_sample_s *sample)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CONFIG_NXWM_CALIBRATION_ANISOTROPIC
|
||||
// We have valid coordinates. Get the raw touch
|
||||
// position from the sample
|
||||
|
||||
float rawX = (float)sample->point[0].x;
|
||||
float rawY = (float)sample->point[0].y;
|
||||
|
||||
// Create a line (varying in X) that have the same matching Y values
|
||||
// X lines:
|
||||
//
|
||||
// x2 = slope*y1 + offset
|
||||
//
|
||||
// X value calculated on the left side for the given value of y
|
||||
|
||||
float leftX = rawY * m_calibData.left.slope + m_calibData.left.offset;
|
||||
|
||||
// X value calculated on the right side for the given value of y
|
||||
|
||||
float rightX = rawY * m_calibData.right.slope + m_calibData.right.offset;
|
||||
|
||||
// Line of X values between (m_calibData.leftX,leftX) and (m_calibData.rightX,rightX) the
|
||||
// are possible solutions:
|
||||
//
|
||||
// x2 = slope * x1 - offset
|
||||
|
||||
struct SCalibrationLine xLine;
|
||||
xLine.slope = (float)((int)m_calibData.rightX - (int)m_calibData.leftX) / (rightX - leftX);
|
||||
xLine.offset = (float)m_calibData.leftX - leftX * xLine.slope;
|
||||
|
||||
// Create a line (varying in Y) that have the same matching X value
|
||||
// X lines:
|
||||
//
|
||||
// y2 = slope*x1 + offset
|
||||
//
|
||||
// Y value calculated on the top side for a given value of X
|
||||
|
||||
float topY = rawX * m_calibData.top.slope + m_calibData.top.offset;
|
||||
|
||||
// Y value calculated on the bottom side for a give value of X
|
||||
|
||||
float bottomY = rawX * m_calibData.bottom.slope + m_calibData.bottom.offset;
|
||||
|
||||
// Line of Y values between (topy,m_calibData.topY) and (bottomy,m_calibData.bottomY) that
|
||||
// are possible solutions:
|
||||
//
|
||||
// y2 = slope * y1 - offset
|
||||
|
||||
struct SCalibrationLine yLine;
|
||||
yLine.slope = (float)((int)m_calibData.bottomY - (int)m_calibData.topY) / (bottomY - topY);
|
||||
yLine.offset = (float)m_calibData.topY - topY * yLine.slope;
|
||||
|
||||
// Then scale the raw x and y positions
|
||||
|
||||
float scaledX = rawX * xLine.slope + xLine.offset;
|
||||
float scaledY = rawY * yLine.slope + yLine.offset;
|
||||
|
||||
x = (nxgl_coord_t)scaledX;
|
||||
y = (nxgl_coord_t)scaledY;
|
||||
|
||||
#else
|
||||
// We have valid coordinates. Get the raw touch
|
||||
// position from the sample
|
||||
|
||||
@ -517,7 +577,9 @@ void CTouchscreen::handleMouseInput(struct touch_sample_s *sample)
|
||||
y = (nxgl_coord_t)bigY;
|
||||
}
|
||||
|
||||
vdbg("raw: (%d, %d) scaled: (%d, %d)\n", rawX, rawY, x, y);
|
||||
#endif
|
||||
|
||||
gvdbg("raw: (%d, %d) scaled: (%d, %d)\n", rawX, rawY, x, y);
|
||||
}
|
||||
|
||||
// Get the server handle and "inject the mouse data
|
||||
|
Loading…
x
Reference in New Issue
Block a user