|
|
@ -4,6 +4,13 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
#include "MouseWrapper.h"
|
|
|
|
#include "MouseWrapper.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t MouseWrapper_::next_width;
|
|
|
|
|
|
|
|
uint16_t MouseWrapper_::next_height;
|
|
|
|
|
|
|
|
uint16_t MouseWrapper_::section_top;
|
|
|
|
|
|
|
|
uint16_t MouseWrapper_::section_left;
|
|
|
|
|
|
|
|
boolean MouseWrapper_::is_warping;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t MouseWrapper_::mouseActiveForCycles;
|
|
|
|
|
|
|
|
|
|
|
|
MouseWrapper_::MouseWrapper_(void) {
|
|
|
|
MouseWrapper_::MouseWrapper_(void) {
|
|
|
|
Mouse.begin();
|
|
|
|
Mouse.begin();
|
|
|
@ -20,17 +27,12 @@ void MouseWrapper_::release_button(uint8_t button) {
|
|
|
|
Mouse.release(button);
|
|
|
|
Mouse.release(button);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MouseWrapper_::warp_jump(uint16_t left, uint16_t top, uint16_t height, uint16_t width) {
|
|
|
|
void MouseWrapper_::warp_jump(uint16_t left, uint16_t top, uint16_t height, uint16_t width) {
|
|
|
|
uint16_t x_center = left + width/2;
|
|
|
|
uint16_t x_center = left + width/2;
|
|
|
|
uint16_t y_center = top + height/2;
|
|
|
|
uint16_t y_center = top + height/2;
|
|
|
|
AbsoluteMouse.moveTo(x_center, y_center);
|
|
|
|
AbsoluteMouse.moveTo(x_center, y_center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MouseWrapper_::begin_warping() {
|
|
|
|
void MouseWrapper_::begin_warping() {
|
|
|
|
section_left = WARP_ABS_LEFT;
|
|
|
|
section_left = WARP_ABS_LEFT;
|
|
|
|
section_top = WARP_ABS_TOP;
|
|
|
|
section_top = WARP_ABS_TOP;
|
|
|
@ -48,13 +50,11 @@ void MouseWrapper_::warp(uint8_t warp_cmd) {
|
|
|
|
begin_warping();
|
|
|
|
begin_warping();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (warp_cmd & WARP_END) {
|
|
|
|
if (warp_cmd & WARP_END) {
|
|
|
|
end_warping();
|
|
|
|
end_warping();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next_width = next_width/2;
|
|
|
|
next_width = next_width/2;
|
|
|
|
next_height = next_height/2;
|
|
|
|
next_height = next_height/2;
|
|
|
|
|
|
|
|
|
|
|
@ -73,10 +73,8 @@ void MouseWrapper_::warp(uint8_t warp_cmd) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
warp_jump(section_left, section_top, next_height,next_width);
|
|
|
|
warp_jump(section_left, section_top, next_height,next_width);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cubic wave function based on code from FastLED
|
|
|
|
// cubic wave function based on code from FastLED
|
|
|
|
uint8_t MouseWrapper_::acceleration(uint8_t cycles) {
|
|
|
|
uint8_t MouseWrapper_::acceleration(uint8_t cycles) {
|
|
|
|
uint8_t i = cycles;
|
|
|
|
uint8_t i = cycles;
|
|
|
|