-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented optional on screen usage of Surface Dial, reworked some o… #169
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
thank you for your PR! I'm requesting some changes.
- Please review my comments in the code
- Please update the sample so that others can see how to use your new functions.
Also, did you test this code yet?
src/HID-APIs/SurfaceDialAPI.h
Outdated
@@ -49,17 +49,29 @@ class SurfaceDialAPI | |||
inline void end(void); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like a more readable name here
src/HID-APIs/SurfaceDialAPI.h
Outdated
@@ -49,17 +49,29 @@ class SurfaceDialAPI | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validation of a correct value is not done yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how should the values be validated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows expects a value for the width if you want to use the position reporting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the width is constant, minimum value is 3000, maximum value is 3000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this work with a count rather than with millis directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk i found the code online and adapted it for this purpose
@@ -32,12 +32,15 @@ typedef union{ | |||
uint8_t whole8[0]; | |||
uint16_t whole16[0]; | |||
uint32_t whole32[0]; | |||
uint64_t whole64[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NicoHood what would the length be?
@@ -49,17 +52,30 @@ class SurfaceDialAPI | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W.r.t. the data type - shouldn't the X and Y coordinates be unsigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but isnt 0, 0 the screen center?
report.rotation = 0; | ||
if(_onScreen) | ||
{ | ||
report.xAxis = _xAxis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
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