mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2025-12-12 10:18:49 +01:00
update keyboard code,followed updates from foriequal0
This commit is contained in:
parent
82191b8466
commit
f0cc9f250e
1093
Code/devterm_keyboard/bin/DevTerm_keyboard_firmware_v0.21_utils.sh
Executable file
1093
Code/devterm_keyboard/bin/DevTerm_keyboard_firmware_v0.21_utils.sh
Executable file
File diff suppressed because it is too large
Load Diff
BIN
Code/devterm_keyboard/hex/devterm.kbd.0.21_48mhz.bin
Normal file
BIN
Code/devterm_keyboard/hex/devterm.kbd.0.21_48mhz.bin
Normal file
Binary file not shown.
2050
Code/devterm_keyboard/hex/devterm.kbd.0.21_48mhz.hex
Normal file
2050
Code/devterm_keyboard/hex/devterm.kbd.0.21_48mhz.hex
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,13 @@ void RateMeter::onInterrupt() {
|
|||||||
|
|
||||||
void RateMeter::tick(millis_t delta) {
|
void RateMeter::tick(millis_t delta) {
|
||||||
cutoff.updateTime(delta);
|
cutoff.updateTime(delta);
|
||||||
|
if (!cutoff.get()) {
|
||||||
|
averageDelta += delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RateMeter::expire() {
|
||||||
|
cutoff.expire();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t RateMeter::delta() const {
|
uint16_t RateMeter::delta() const {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ enum Axis: uint8_t {
|
|||||||
AXIS_Y,
|
AXIS_Y,
|
||||||
AXIS_NUM,
|
AXIS_NUM,
|
||||||
};
|
};
|
||||||
|
static TrackballMode lastMode;
|
||||||
static int8_t distances[AXIS_NUM];
|
static int8_t distances[AXIS_NUM];
|
||||||
static RateMeter rateMeter[AXIS_NUM];
|
static RateMeter rateMeter[AXIS_NUM];
|
||||||
static Glider glider[AXIS_NUM];
|
static Glider glider[AXIS_NUM];
|
||||||
@ -51,20 +51,30 @@ static void interrupt() {
|
|||||||
const auto vy = ry * ratio;
|
const auto vy = ry * ratio;
|
||||||
|
|
||||||
if (AXIS == AXIS_X) {
|
if (AXIS == AXIS_X) {
|
||||||
glider[AXIS_X].update(vx, rateMeter[AXIS_X].delta());
|
glider[AXIS_X].update(vx, std::sqrt(rateMeter[AXIS_X].delta()));
|
||||||
glider[AXIS_Y].updateSpeed(vy);
|
glider[AXIS_Y].updateSpeed(vy);
|
||||||
} else {
|
} else {
|
||||||
glider[AXIS_X].updateSpeed(vx);
|
glider[AXIS_X].updateSpeed(vx);
|
||||||
glider[AXIS_Y].update(vy, rateMeter[AXIS_Y].delta());
|
glider[AXIS_Y].update(vy, std::sqrt(rateMeter[AXIS_Y].delta()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void trackball_task(DEVTERM*dv) {
|
void trackball_task(DEVTERM*dv) {
|
||||||
int8_t x = 0, y = 0, w = 0;
|
int8_t x = 0, y = 0, w = 0;
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
|
const auto mode = dv->state->moveTrackball();
|
||||||
|
if (lastMode != mode) {
|
||||||
|
rateMeter[AXIS_X].expire();
|
||||||
|
rateMeter[AXIS_Y].expire();
|
||||||
|
wheelBuffer = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
rateMeter[AXIS_X].tick(dv->delta);
|
rateMeter[AXIS_X].tick(dv->delta);
|
||||||
rateMeter[AXIS_Y].tick(dv->delta);
|
rateMeter[AXIS_Y].tick(dv->delta);
|
||||||
const auto mode = dv->state->moveTrackball();
|
}
|
||||||
|
lastMode = mode;
|
||||||
|
|
||||||
switch(mode){
|
switch(mode){
|
||||||
case TrackballMode::Mouse: {
|
case TrackballMode::Mouse: {
|
||||||
const auto rX = glider[AXIS_X].glide(dv->delta);
|
const auto rX = glider[AXIS_X].glide(dv->delta);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user