Implemented optional on screen usage of Surface Dial, reworked some o…#169
Implemented optional on screen usage of Surface Dial, reworked some o…#169OmegaRogue wants to merge 13 commits intoNicoHood:masterfrom
Conversation
src/HID-APIs/SurfaceDialAPI.h
Outdated
| inline void click(void); | ||
| inline void rotate(int16_t rotation); | ||
| inline void position(int8_t x, int8_t y); | ||
| inline void posrot(int16_t rotation, int8_t x, int8_t y); |
There was a problem hiding this comment.
I would like a more readable name here
src/HID-APIs/SurfaceDialAPI.h
Outdated
| inline void end(void); | ||
| inline void click(void); | ||
| inline void rotate(int16_t rotation); | ||
| inline void position(int8_t x, int8_t y); |
There was a problem hiding this comment.
please review your indentation settings. now it looks like it is wrongly indented.
| report.rotation = 0; | ||
| if(_onScreen) | ||
| { | ||
| report.xAxis = _xAxis; |
There was a problem hiding this comment.
validation of a correct value is not done yet
There was a problem hiding this comment.
how should the values be validated?
There was a problem hiding this comment.
ah, I see in the docs that you can specify values out of range to remove the device from the screen
There was a problem hiding this comment.
Which Docs say that you can specify values out of the range to remove the device from the screen?
| update(); | ||
| } | ||
|
|
||
| void SurfaceDialAPI::update() |
There was a problem hiding this comment.
Not very intuitive what the difference between posrot and update is. It turns out the difference is in the rotation variable.
src/HID-APIs/SurfaceDialAPI.hpp
Outdated
| posrot(0, x, y); | ||
| } | ||
|
|
||
| void SurfaceDialAPI::posrot(int16_t rotation, int8_t x, int8_t y) |
There was a problem hiding this comment.
Please change this name into something more readable if you intend to keep this function
| 0x46, 0xb0, 0x36, // PHYSICAL_MAXIMUM (14000) | ||
| 0x81, 0x02, // INPUT (Data,Var,Abs) | ||
| 0x05, 0x0d, // USAGE_PAGE (Digitizers) | ||
| 0x09, 0x48, // USAGE (Width) |
There was a problem hiding this comment.
Windows expects a value for the width if you want to use the position reporting.
There was a problem hiding this comment.
but the width is constant, minimum value is 3000, maximum value is 3000
|
I haven't tested it yet, and ill make changes to the code regarding your comments and update the sample, also ive added a long click/ short click detection to a modified version of the sample i use myself |
|
ok now everything should be fixed, the arduino sketch compiles, but it doesnt put it on screen |
|
and i have no idea why |
|
Does it work with my code? So what is currently in master? (without position) |
| unsigned long keyPrevMillis = 0; | ||
| const unsigned long keySampleIntervalMs = 25; | ||
| byte longKeyPressCountMax = 840; // 80 * 25 = 2000 ms | ||
| byte longKeyPressCount = 0; |
There was a problem hiding this comment.
why does this work with a count rather than with millis directly?
There was a problem hiding this comment.
idk i found the code online and adapted it for this purpose
| uint8_t whole8[0]; | ||
| uint16_t whole16[0]; | ||
| uint32_t whole32[0]; | ||
| uint64_t whole64[0]; |
There was a problem hiding this comment.
I believe these wholeX variables are actually not needed, see #147
If you want you can remove them after testing.
There was a problem hiding this comment.
@hansmbakker Would you mind checking the project where those variables are used, and remove them entirely from the project? Maybe the uin8_t version could be kept with the name "raw", but a proper length value.
There was a problem hiding this comment.
@NicoHood unfortunately I'm a bit busy on other things to pick this up quickly; also it is not immediately clear to me what you mean with
but a proper length value
@NicoHood or @OmegaRogue is that something you could pick up?
| inline void end(void); | ||
| inline void click(void); | ||
| inline void rotate(int16_t rotation); | ||
| inline void position(int16_t x, int16_t y); |
There was a problem hiding this comment.
W.r.t. the data type - shouldn't the X and Y coordinates be unsigned?
There was a problem hiding this comment.
but isnt 0, 0 the screen center?
| report.rotation = 0; | ||
| if(_onScreen) | ||
| { | ||
| report.xAxis = _xAxis; |
There was a problem hiding this comment.
ah, I see in the docs that you can specify values out of range to remove the device from the screen
| 0x46, 0xb0, 0x36, // PHYSICAL_MAXIMUM (14000) | ||
| 0x81, 0x02, // INPUT (Data,Var,Abs) | ||
| 0x05, 0x0d, // USAGE_PAGE (Digitizers) | ||
| 0x09, 0x48, // USAGE (Width) |
|
I just reviewed the comments from @hansmbakker, all his request are valid. Please update accordingly. |
Pulling the new Commits from NicoHood/HID to this fork
Sync with head repo
…ther stuff