-
Notifications
You must be signed in to change notification settings - Fork 12
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
Drawsome Tablet #57
Drawsome Tablet #57
Conversation
Raphnet link for reference: https://www.raphnet.net/divers/wii_graphics_tablets/index_en.php My strategy so far has been to be very laissez-faire with the data, so the library just acts as a go-between and doesn't assume how the user wants to use it. The difference in the tablet origins is important, and I think it should be documented as a comment in the source.
I haven't been, just because it's presumably slightly different for each individual controller. The two genuine Nunchuks I have for instance use wildly different min/max points for each joystick axis and accelerometer while the third party Nunchuk I have makes full use of the entire joystick range. My assumption is that if you're trying to use the library for any given controller, you have a physical copy of that controller and you can see the range of your particular device while testing. But maybe that's a bad assumption. Since I doubt there's a knockoff "Drawsome" tablet out there it wouldn't hurt to add a "typical" range comment to the example and the header. As for changes, make sure you update the range comments in the "Demo" example to match the range of the new data maps. And be sure to change the I'll see if I can set aside some time this week to try and integrate the extra registry writes into the communication flow. I saw your message on Twitter. DM'd you there :) |
Any update on getting the extra write bytes going? :) |
Not yet. I've been busy with other projects, and I'm still not quite sure how I want to integrate the extra register writes into the program flow. |
Fiddling a bit with this now. I'm thinking the best way to do the extra register writes is to have a virtual function as part of the The sticking point here is using multiple controllers at the same time. In that case, the ExtensionPort port;
ClassicController classic(port);
DrawsomeTablet tablet(port);
boolean connected = false;
void setup() {
port.begin();
}
void loop() {
if(!connected && port.connect()) {
switch(port.getControllerType()) {
case(ExtensionType::ClassicController):
connected = classic.customInit();
break;
case(ExtensionType::DrawsomeTablet):
connected = tablet.customInit();
break;
}
}
// reading controller data follows
} Which technically works, but it's neither pretty nor intuitive. Any thoughts? Or ideas on the name for the function? |
Hmm. The first thing that comes to mind, is to possibly pass either the object or a way to differentiate it, then having it run the customInit there. But.. that would be a little abstract/require per-controller overrides... Another issue I personally see with this, is that it'd be a little wasteful to run the Especially with how undocumented this all is, I'm not sure how the controllers would react to having that mode set again and again. Then again, I could be talking out of my butt. I'm not totally against it, especially since you do something similar in I'll ask around to see if anyone can think of a better solution As for the naming, I feel And, a thought just blipped into my head. We've been using certain min-maxes for the ClassicController for a hot while. Are you planning on possibly breaking the old programs that have hardcoded ranges? Making it optional via a flag |
Sure, although at that point you're just hiding that switch in another function. You'd still have to break the typical program flow to call it (and know when to you need to call it). Like I said, the custom initialization(s) would be virtual if you're calling the
I'm not sure what you mean here. You would only run the custom initialization once, on connection.
That's a fair point. I'm having trouble coming up with a name that fits well, although I do like the 'init' keyword as a part of it. Perhaps
That's a different topic - at the moment I'm just talking about adjusting the library's comm flow to work with extra register writes during initialization. I haven't gotten to it yet, but the "high res" Classic Controller implementation will likely end up as its own class, separate from the current one. |
Again, having a similar syntax to the previous example, in my eyes, gives it a bit of a pass. That's just me, however. Plus it can look a little unruly. I'll let you know if I think of something.
I totally missed the
Maybe something like |
The tablet requires two additional register writes before it will start sending control data. The library now supports this functionality without issue (yay!). See the notes here: https://www.raphnet.net/divers/wii_graphics_tablets/index_en.php
This function was removed in the latest pull request. connect() is now used for both connection and reconnection attempts.
Sorry for the long wait. The library now has the functionality to add those extra registry writes. Give those examples a try and let me know how it goes. |
Tested the branch with just the tablet, and it works perfectly! :) Great job! |
Merged. Thank you! |
Also forgot about this in #57.
So, it's quite a bit simpler than the uDraw, but I think I prefer it... minus the magic address writing that has to be done.
Anyway, this is tested and working so far.
(Tested with this added to
NXC_Comms.h
)
Some notes:
1.
The X and Y mapping they use is different.(Photos from Raphnet)
Y is flipped.
2.
When the pen is off the surface, uDraw sets it to an impossible value. Drawsome leaves at at previous.3.
Neither tablet uses the whole range of the allocated bytes given for pressure/x/y, etc. Should we document this somewhere, using the values provided by raphnet/our own testing?