-
Notifications
You must be signed in to change notification settings - Fork 2
The Duration and Repetition Gap
Not every part of the communication protocol is figured out, as I am again no expert in any of this, but for better or for worse a solid pattern exists for all stimuli commands. Data is formatted as "8(number of repetitions)0c(level of intensity)(duration_on)(gap between repetitions)", all values being integers converted to hexidecimal values. The "8" and the "0c" are still a work in progress. Shock only utilises count and level, for some reason sending a much shorter packet than the other stimuli. Other handles such as "Button Assign" and "Clock" have specific formats as well, but those were a bit easier to figure out by just figitting with settings in the Pavlok app and seeing what it communicated to the device.
What was the most odd was the existence of a duration option and a gap between repetitions, as these features are not available in the app. In fact, I only figured out their use by randomly assigning values and seeing what would happen. Furthermore, they don't seem to accept values the same way as the other fields, and I couldn't quite find a pattern. Instead, I sampled every level (0-63, in hex) with as much stopwatch accuracy as I could get with my computer and came up with an exponential regression that rather accurately calculates a time in seconds from a given hex value. The user entered time, in seconds, is fed to the model and the hex value returned is sent to the device.