Fixes and add spotlight and default screen

pull/3115/head
7kasper 2023-11-29 11:20:07 +01:00
parent ff4a57de76
commit 65fa387739
No known key found for this signature in database
GPG Key ID: 4AD2FD3E13BFB86A
4 changed files with 51 additions and 23 deletions

View File

@ -10,4 +10,5 @@
0.10: Bugfixes.
0.11: Fix mouse move getting stuck.
0.12: Added support for mouse dragging action (click then drag).
0.13: Removed mouse dragging (too buggy/unuseful).
0.13: Removed mouse dragging (too buggy/unuseful).
0.14: Bugfix and add pointer mode. Also added default screen when no parts are there.

View File

@ -56,16 +56,24 @@ If "Try connecting your device again." is shown, switch PC/laptop bluetooth off
16. Mouse mode
- Swipe to move pointer over the presentation screen
- Tap to left click.
- Hold longer to right click.
17. Holding mode
In timer/presentation mode, hold one finger on your Bangle screen, point your arm foreward
- Mouse up/down on screen: Tilt your hand up/down
- Mouse left/right on screen: Rotate your hand counterclockwise/clockwise
18. End of presentation?
18. Spotlight mode
- Dubble press button to go into presentor mode.
- Allows to move mouse but no clicking.
- Presses SHIFT+F10 on start (you can use app such as powertoys to set spotlight to this combo)
- Presses F10 at the end (will dis-engage spotlight for instance in powertoys)
19. End of presentation?
Switch bluetooth PC/laptop off or see step 1
19. Re-activate smartphone bluetooth (incl. Gadgetbridge)
20. Re-activate smartphone bluetooth (incl. Gadgetbridge)
### Creator
[7kasper](https://github.com/7kasper)

View File

@ -1,5 +1,5 @@
// Presentor by 7kasper (Kasper Müller)
// Version 4.0
// Version 0.14
// Imports
const bt = require("ble_hid_combo");
@ -85,6 +85,7 @@ let lasty = 0;
// Mouse states
let holding = false;
let trackPadMode = false;
let focusMode = false;
// Timeout IDs.
let timeoutId = -1;
@ -97,6 +98,7 @@ let homePitch = 0;
let mCal = 0;
let mttl = 0;
let cttl = 0;
let bttl = 0;
// BT helper.
let clearToSend = true;
@ -198,6 +200,11 @@ function drawMain() {
function doPPart(r) {
pparti += r;
if (settings.pparts.length == 0) {
mainLayout.Subject.label = 'PRESENTOR';
mainLayout.Notes.label = '';
return;
}
if (pparti < 0) {
pparti = -1;
mainLayout.Subject.label = 'PAUSED';
@ -264,21 +271,22 @@ Bangle.on('lock', function(on) {
});
function startHolding() {
bt.tapKey(0xE0, () => bt.tapKey(0xE0));
bt.tapKey(bt.KEY.F10, bt.MODIFY.SHIFT);
holding = true;
focusMode = true;
Bangle.buzz();
E.showMessage('Holding');
Bangle.on('accel', handleAcc);
Bangle.setLCDPower(1);
}
function stopHolding() {
clearTimeout(timeoutHolding);
if (holding) {
bt.tapKey(0xE0);
bt.tapKey(bt.KEY.F10);
// bt.tapKey(bt.KEY.F10);
homePitch = 0;
homeRoll = 0;
holding = false;
focusMode = false;
mCal = 0;
Bangle.removeListener('accel', handleAcc);
Bangle.buzz();
@ -318,17 +326,17 @@ Bangle.on('drag', function(e) {
timeoutSendMouse = setTimeout(function() {clearToSend = true; timeoutSendMouse = -1;}, 50);
}
if (!e.b) {
// short press
if (getTime() - cttl < 0.2) {
bt.holdButton(bt.BUTTON.LEFT);
console.log("click left");
clearToSend = true;
}
// longer press in center
else if (getTime() - cttl < 0.6 && e.x > g.getWidth()/4 && e.x < 3 * g.getWidth()/4 && e.y > g.getHeight() / 4 && e.y < 3 * g.getHeight() / 4) {
bt.holdButton(bt.BUTTON.RIGHT);
console.log("click right");
clearToSend = true;
if (!focusMode) {
// short press
if (getTime() - cttl < 0.2) {
bt.clickButton(bt.BUTTON.LEFT);
console.log("click left");
}
// longer press in center
else if (getTime() - cttl < 0.6 && e.x > g.getWidth()/4 && e.x < 3 * g.getWidth()/4 && e.y > g.getHeight() / 4 && e.y < 3 * g.getHeight() / 4) {
bt.clickButton(bt.BUTTON.RIGHT);
console.log("click right");
}
}
cttl = 0;
lastx = 0;
@ -372,9 +380,19 @@ Bangle.on('drag', function(e) {
function onBtn() {
if (trackPadMode) {
trackPadMode = false;
stopHolding();
drawMain();
if ((getTime() - bttl < 0.4 && !focusMode)) {
E.showMessage('Pointer');
focusMode = true;
bt.tapKey(bt.KEY.F10, bt.MODIFY.SHIFT);
} else {
trackPadMode = false;
stopHolding();
drawMain();
if (focusMode) {
bt.tapKey(bt.KEY.F10);
focusMode = false;
}
}
} else {
stopHolding();
clearToSend = true;
@ -384,7 +402,8 @@ function onBtn() {
if (timeoutDraw != -1) {
clearTimeout(timeoutDraw);
timeoutDraw = -1;
}
}
bttl = getTime();
}
Bangle.buzz();
}

View File

@ -1,7 +1,7 @@
{
"id": "presentor",
"name": "Presentor",
"version": "0.13",
"version": "0.14",
"description": "Use your Bangle to present!",
"icon": "app.png",
"type": "app",