|
|
|
@ -146,6 +146,7 @@ void command_reboot_bootloader() {
|
|
|
|
|
while(1) {} // This infinite loop ensures nothing else
|
|
|
|
|
// happens before the watchdog reboots us
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void command_plugh() {
|
|
|
|
|
commandMode = !commandMode;
|
|
|
|
|
if (commandMode) {
|
|
|
|
@ -391,88 +392,6 @@ void report(byte row, byte col, boolean value)
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _draw_warp_section(long x_origin, long y_origin, long x_end, long y_end, int tracing_scale) {
|
|
|
|
|
|
|
|
|
|
if ( x_origin != x_end ) { // it's a horizontal line
|
|
|
|
|
|
|
|
|
|
if (x_origin > x_end) { // right to left
|
|
|
|
|
// tracing_scale = (x_origin-x_end) /100;
|
|
|
|
|
for (long x = x_origin ; x>= x_end; x=x-tracing_scale) {
|
|
|
|
|
Mouse.moveAbsolute(x,y_origin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else { // left to right
|
|
|
|
|
// tracing_scale = (x_end-x_origin) /100;
|
|
|
|
|
for (long x = x_origin ; x<= x_end; x=x+tracing_scale) {
|
|
|
|
|
Mouse.moveAbsolute(x,y_origin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else { // it's a vertical line
|
|
|
|
|
|
|
|
|
|
if (y_origin > y_end) { // bottom to top
|
|
|
|
|
// tracing_scale = (y_origin-y_end) /100;
|
|
|
|
|
for (long y = y_origin ; y>= y_end; y=y-tracing_scale) {
|
|
|
|
|
Mouse.moveAbsolute(x_origin,y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else { // top to bottom
|
|
|
|
|
// tracing_scale = (y_end-y_origin) /100;
|
|
|
|
|
for (long y = y_origin ; y<= y_end; y=y+tracing_scale) {
|
|
|
|
|
Mouse.moveAbsolute(x_origin, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define CLOVER_TRACE_SCALE 50
|
|
|
|
|
|
|
|
|
|
void _warp_clover(long left, long top, long height, long width) {
|
|
|
|
|
long x_center = left + width/2;
|
|
|
|
|
long y_center = top + height/2;
|
|
|
|
|
long right = left + width;
|
|
|
|
|
long bottom = top + height;
|
|
|
|
|
_draw_warp_section(x_center, y_center, left, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section(left, y_center, left,top, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section(left, top , x_center,top, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( x_center,top, x_center, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section(x_center, y_center, x_center, bottom, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( x_center, bottom, right, bottom, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( right, bottom, right, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( right, y_center, x_center, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( x_center, y_center, left, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
|
|
|
|
|
_draw_warp_section( left,y_center,left, bottom, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section(left, bottom, x_center, bottom, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( x_center, bottom, x_center, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( x_center, y_center, x_center,top, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( x_center,top, right, top, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( right, top, right, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
_draw_warp_section( right, y_center, x_center, y_center, CLOVER_TRACE_SCALE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _warp_cross(long left, long top, long height, long width) {
|
|
|
|
|
long x_center = left + width/2;
|
|
|
|
|
long y_center = top + height/2;
|
|
|
|
|
long right = left + width;
|
|
|
|
|
long bottom = top + height;
|
|
|
|
|
|
|
|
|
|
_draw_warp_section(x_center, y_center, x_center, top,40);
|
|
|
|
|
_draw_warp_section(x_center, top, x_center, bottom,40);
|
|
|
|
|
_draw_warp_section( x_center, bottom, x_center, y_center,40);
|
|
|
|
|
_draw_warp_section( x_center, y_center,left,y_center,40);
|
|
|
|
|
_draw_warp_section(left, y_center, right, y_center,40);
|
|
|
|
|
_draw_warp_section(right, y_center, x_center, y_center,40);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _warp_jump(long left, long top, long height, long width) {
|
|
|
|
|
long x_center = left + width/2;
|
|
|
|
@ -530,26 +449,6 @@ void warp_mouse(Key ninth) {
|
|
|
|
|
next_width = next_width / 2;
|
|
|
|
|
next_height = next_height/2;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_SERIAL
|
|
|
|
|
Serial.print("Current box: ");
|
|
|
|
|
Serial.print(section_left);
|
|
|
|
|
Serial.print(",");
|
|
|
|
|
Serial.print(section_top);
|
|
|
|
|
Serial.print(" to: ");
|
|
|
|
|
Serial.print(section_left+next_width);
|
|
|
|
|
Serial.print(",");
|
|
|
|
|
Serial.print(section_top+next_height);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Serial.print("\nwarping - the next box size is ");
|
|
|
|
|
Serial.print(next_width);
|
|
|
|
|
Serial.print(", ");
|
|
|
|
|
Serial.print(next_height);
|
|
|
|
|
Serial.print("\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (ninth.rawKey & MOUSE_UP) {
|
|
|
|
|
// Serial.print(" - up ");
|
|
|
|
|
} else if (ninth.rawKey & MOUSE_DN) {
|
|
|
|
@ -564,27 +463,6 @@ void warp_mouse(Key ninth) {
|
|
|
|
|
section_left = section_left + next_width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_SERIAL
|
|
|
|
|
Serial.print("\nShould end up at ");
|
|
|
|
|
Serial.print(section_left + next_width/ 2);
|
|
|
|
|
Serial.print(",");
|
|
|
|
|
Serial.print(section_top + next_height / 2);
|
|
|
|
|
Serial.print("That should be half way between ");
|
|
|
|
|
Serial.print(section_left);
|
|
|
|
|
Serial.print(",");
|
|
|
|
|
Serial.print(section_top);
|
|
|
|
|
Serial.print(" and ");
|
|
|
|
|
Serial.print(section_left + next_width);
|
|
|
|
|
Serial.print(",");
|
|
|
|
|
Serial.print(section_top+next_height);
|
|
|
|
|
Serial.print("\n");
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// the cloverleaf
|
|
|
|
|
|
|
|
|
|
// _warp_cross(section_left, section_top, next_height,next_width);
|
|
|
|
|
|
|
|
|
|
_warp_jump(section_left, section_top, next_height,next_width);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -635,22 +513,6 @@ void handle_mouse_movement( char x, char y)
|
|
|
|
|
moveY = (y * accel) - carriedOverY;
|
|
|
|
|
carriedOverY = ceil(moveY) - moveY;
|
|
|
|
|
}
|
|
|
|
|
#ifdef DEBUG_SERIAL
|
|
|
|
|
Serial.println();
|
|
|
|
|
Serial.print("cycles: ");
|
|
|
|
|
Serial.println(mouseActiveForCycles);
|
|
|
|
|
Serial.print("Accel: ");
|
|
|
|
|
Serial.print(accel);
|
|
|
|
|
Serial.print(" moveX is ");
|
|
|
|
|
Serial.print(moveX);
|
|
|
|
|
Serial.print(" moveY is ");
|
|
|
|
|
Serial.print(moveY);
|
|
|
|
|
Serial.print(" carriedoverx is ");
|
|
|
|
|
Serial.print(carriedOverX);
|
|
|
|
|
Serial.print(" carriedOverY is ");
|
|
|
|
|
Serial.println(carriedOverY);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
end_warping();
|
|
|
|
|
|
|
|
|
|
Mouse.move(moveX, moveY, 0);
|
|
|
|
|