Skip to content
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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

OmegaRogue
Copy link

…ther stuff

Copy link
Contributor

@hansmbakker hansmbakker left a 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?

@@ -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);
Copy link
Contributor

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

@@ -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);
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Author

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?

Copy link
Contributor

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

Copy link
Author

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()
Copy link
Contributor

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.

posrot(0, x, y);
}

void SurfaceDialAPI::posrot(int16_t rotation, int8_t x, int8_t y)
Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@OmegaRogue
Copy link
Author

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

@OmegaRogue
Copy link
Author

ok now everything should be fixed, the arduino sketch compiles, but it doesnt put it on screen

@OmegaRogue
Copy link
Author

and i have no idea why

@hansmbakker
Copy link
Contributor

Does it work with my code? So what is currently in master? (without position)

.idea/codeStyles/codeStyleConfig.xml Outdated Show resolved Hide resolved
.idea/deployment.xml Outdated Show resolved Hide resolved
.idea/vcs.xml Outdated Show resolved Hide resolved
unsigned long keyPrevMillis = 0;
const unsigned long keySampleIntervalMs = 25;
byte longKeyPressCountMax = 840; // 80 * 25 = 2000 ms
byte longKeyPressCount = 0;
Copy link
Contributor

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?

Copy link
Author

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];
Copy link
Contributor

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.

Copy link
Owner

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.

Copy link
Contributor

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?

Copy link
Author

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);
Copy link
Contributor

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?

Copy link
Author

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;
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@NicoHood
Copy link
Owner

I just reviewed the comments from @hansmbakker, all his request are valid. Please update accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants