-
Long time ago I tried this with P8 and failed
hi, i have the same goal, using pinetime/p8 as a backup platform for bangle.js v2,
of course it would be good if pt/p8 can also run the bangle store apps like bangle1/2.I am a layman. Do you think you and others could enlighten me so I could ask gpt4 to make a try?
As you may see my other posts, it DID wrote me a bangle app for soft-reboot, modify the "swipe back to clock"and"back swipe"'s swipe direction, also the microwave bangle app; among many other things outside bangle.OR, if you could intelligently break it up into smaller steps, i could try to use gpt4 to do the small steps 1 at a time...etc.
ps:
I have the concept of traditional programming and some OOP, i just dont want to learn the "gramma" of 100+ languages. It's ridiculous that some use for (i++,j++) and some use for [i++;j++] etc.ps2:
my swd tools just arrived, i am now trying to un-brick my p8b-mirror > < -
hi, before i implment the 4 list/menu for the "swipe back to clock" or "back swipe",
currently the best way is leave "swipe back to clock" untouched, handle any Lt to Rt swipe, as it works on any clock/app ("backswipe" only work if there is an arrow at Lt upper corner).and modify "back swipe" into swipe U to D:
function goBack(lr, _) { // if it is a left to right swipe if (lr === 1) { // if we're in an app that has a back button, run the callback for it if (global.BACK && countHandlers("swipe")<=settings.standardNumSwipeHandlers && countHandlers("drag")<=settings.standardNumDragHandlers) { global.BACK(); } } }
simply change the
function goBack(lr, _) {into function goBack(_, lr) {
-
-
NOT very helpful,
now with "swipe back to clock" using swipe up to down, then in "folder launcher", you cant scroll upso,
the 4 lists of (always on, whitelist, blacklist, always off) should be extended to L to R, R to L, U to D, D to U, for BOTH "back swipe" and "swipe back to clock"may be if "back swipe" works (1 step back, this never worked for me), a menu will be pop up upon the swipe and let user choose.
it WORKed, but only on apps that have an arrow in the Lt Upper corner.
so when compare to "swipe back to clock", this app brings you back to the clock on any screen. -
hi,
the "alarm and timer ETA" widget currently dont show stopwatch e.g. "stopwatch touch" at the status bar.
I would like to change that.
indeed with the "digital clock widget", we can have clock in status bar and stopwatch in the app;
so i wish at the clock face, we can have time + stopwatch too.ps: this beat the legends like casio f-91, which can only show either clock OR stopwatch, but not both:
I briefly asked gpt4,
let's see how good it is later.
:
You can extend the widget to support the stopwatch by modifying the code to consider the stopwatch's state and time. Here is a modified version of your provided code that should incorporate the stopwatch's display into the widget. The main idea is to read the stopwatch's state and remaining time from its JSON storage and display it on the widget if it's running.- Update the
loadSettings
function to also load the stopwatch settings. - Modify the
draw
function to consider the stopwatch state and display its time if it's running. - Make necessary adjustments in other parts of the code to accommodate the stopwatch display.
Here is the modified version of your provided widget code to incorporate the stopwatch:
javascript (() => { let config, stopwatchConfig; function loadSettings() { config = Object.assign({ // ... (your existing settings) }, require("Storage").readJSON("widalarmeta.json",1) || {}); stopwatchConfig = require("Storage").readJSON("stopwatch.json",1) || {}; // ... (your existing code to load fonts, etc.) } loadSettings(); // ... (your existing functions like getNextAlarm) function draw(_w, fromInterval) { let next; if (stopwatchConfig.state && stopwatchConfig.state.running) { next = Date.now() - stopwatchConfig.state.start; } else { if (this.nextAlarm === undefined) { let alarm = getNextAlarm(); // ... (your existing code) } next = this.nextAlarm !== undefined ? require("sched").getTimeToAlarm(this.nextAlarm) : 0; } // ... (your existing code to display time, handle font and width calculations, etc.) // Add an additional condition to redraw if the stopwatch is running const period = stopwatchConfig.state.running ? 1000 : next === 0 ? 3600000 : (drawSeconds ? 1000 : 60000); // ... (your existing code to set timeout and redraw, etc.) } // ... (your existing code to add the widget and other functionalities, etc.) })();
Changes made:
- Loaded the stopwatch settings along with the alarm settings.
- Checked if the stopwatch is running and updated the
next
variable accordingly. - Added an additional condition to set the redraw period to every second if the stopwatch is running to update the stopwatch display in real-time.
You might need to adjust the display format or layout as per your needs. Ensure to test thoroughly to make sure it works as expected and doesn’t interfere with other functionalities.
- Update the
-
hi, thx
for my bangle:
Bangle["#onswipe"]
=[
function (lr,) { ... },
function (,dir) { ... }
]
Bangle["#ondrag"]
=function (position) { ... }so i chose noswipe to be 2, ondrag to be 1.
yet i have to say not every swipe will trigger it.
in comparision, "swipe back to clock" is more reliable on this.
may be if possible, the action part of "back swipe" should be moved to be triggered by "swipe back to clcok".btw, seems swipe up to down is easily mixed up as drag up to down by the "desktop launcher".
thanks
-
ok, gpt4 worked,
originally after i read the manual i'll uselet swipeHandler = ( 0 , dir) => {
but gpt4 is weak, but still stronger than layman.
so should use let swipeHandler = ( _ , dir) => {
may be no need to upload this subtle thing to the bangle store,
but this will make "swipe back to clock" use swipe Up to Down, instead of Lt to Rt;
so now you can at the same stime use "swipe back" swipe Lt to Rt for 1 step back. -
-
running espruino on pt+p8 is a low priority for me,
as i already got a banglev2.
my aim for pt/p8- proof of concept that espruino run on them
- test whether bangle store apps or diy apps can run on them
1:
as you mentioned there already ppl demo-ed on p8, some for pt.
TG pt users claim the button not working for pt on recovery. probably PIN number problemif i have time, i'll first run it on p8b-mir (need sometime to tune the mirroring), then verify about PIN numbers and see if need to modify.
- too far away from me.
jeffmer etc seems use emulators to let bangle apps run on the ports, gordon suggest writing drivers for it. xxxx_bangle.c. let's see.
- proof of concept that espruino run on them
-
same code as above, i put on github,
using MIT licensehttps://github.com/ccchan234/bangle2-SoftReBoot/blob/main/v002
thank you
-
@Gordon
hi, i think this app is useful, i think i didn't found such an app in the store,
am i wellcomed to submit it to the store?
currently the *.js and *.info is done, have not prepared the icon.
thanksps i am using it right now.
btw, for my currently another project, makeing "swipe back to clock" to use swipe up to down (stage 1) then with a menu (stage 2).
stage 2 wont be a recent work, while i think stage 1 is still useful.
for such a minor modification do you think i should keep it to myself or still submit to the store and rename it somehow? thx -
hi, originally i wann let user choose odd vs even for a randomly displayed number,
but gpt4 not good at it.i simply ask it to make a "screen tap" to confirm the reboot,
and one can escape by using the "switch back to the clock" app's swipe <-- this agree with my idea that at least one swipe should be kept for app control.thanks
i'll see if the store will need this app,
console.log('Starting script.'); (function() { let rebootConfirmed = false; function reboot() { console.log('Attempting to reboot.'); E.reboot(); console.log('Should have rebooted.'); // This may not print if the reboot occurs immediately } console.log('Setting up LCD power event listener.'); Bangle.on('lcdPower', function(on) { console.log('LCD power event triggered. Power state:', on); if (on && rebootConfirmed) { console.log('LCD is on and reboot is confirmed.'); Bangle.setLCDMode('on'); reboot(); } else if (on) { console.log('LCD is on but reboot is not yet confirmed.'); } else { console.log('LCD is off.'); } }); console.log('Clearing the screen and displaying confirmation message.'); g.clear(); g.setFontAlign(0, 0); // center alignment g.setFont("Vector", 15); // Adjusted the font size g.drawString("Tap to confirm", g.getWidth() / 2, g.getHeight() / 2 - 10); g.drawString("reboot", g.getWidth() / 2, g.getHeight() / 2 + 10); console.log('Setting up touch event listener.'); Bangle.on('touch', function(e) { console.log('Touch event triggered. Event data:', e); if (e && !rebootConfirmed) { console.log('Touch detected and reboot is not yet confirmed.'); rebootConfirmed = true; console.log('Clearing the screen and displaying rebooting message.'); g.clear(); g.drawString("Rebooting...", g.getWidth() / 2, g.getHeight() / 2); console.log('Waiting for 2 seconds before reboot.'); setTimeout(() => { console.log('2 seconds elapsed, initiating reboot.'); reboot(); }, 2000); } else if (e) { console.log('Touch detected but reboot is already confirmed.'); } else { console.log('Touch event triggered but no touch detected.'); } }); })(); console.log('Script setup complete.');
-
-
-
hi,
i would sometimes like to reboot the bangle v2 using app, without using the button.i asked GPT4 for this code:
(function() { function reboot() { E.reboot(); } Bangle.on('lcdPower', function(on) { if (on) { Bangle.setLCDMode('on'); reboot(); } }); // Draw a user interface if needed, or execute reboot directly g.clear(); g.setFontAlign(0, 0); // center alignment g.setFont("Vector", 20); g.drawString("Rebooting...", g.getWidth() / 2, g.getHeight() / 2); setTimeout(reboot, 2000); // Execute reboot after 2 seconds for the user to read the screen })();
it worked in the IDE when i connect my real bangle to it, and paste this code on the RHS and press "RAM".
I am going to follow the guideline and make it into an app, is that okay? any suggestions? thanks
wanna name it softreboot for short and SoftReBoot for the plain text name
following this tutorial:
https://www.espruino.com/Bangle.js+First+App -
hi,
although my ultimate aim will be to use only 1 swipe to popup a menu to control "back to clock, back to launcher, back 1 step" etc,
currently my fastest shortcut will be to use "swip back" using swipe left to right,
with "swipe back to clock" <-- if this could be modified to use swipe up to down. currently "swip back to clock" is hard coded to use swipe Lt to Rt so these 2 app cant be used the same time.I found this reference on event Bangle.swipe
manualwith help from GPT4,
it seems for the "swipe back to clock"'s boot.js,
for this part:let swipeHandler = (dir) => { let currentFile = global.__FILE__||"default"; log("swipe:" + dir + " on app: " + currentFile); if (!inhibit && dir === 1 && !Bangle.CLOCK) { log("on a not clock app " + currentFile); if ((settings.mode === 1 && settings.whiteList.includes(currentFile)) || // "White List" (settings.mode === 2 && !settings.blackList.includes(currentFile)) || // "Black List" settings.mode === 3) { // "Always" log("load clock"); Bangle.showClock(); } } inhibit = false; }; Bangle.on("swipe", swipeHandler); }
I simply change it into
let swipeHandler = ( _ , dir) => {will do the trick?
- if it works, i would like to call it "swipe back to clock UD", later i would like to add the menu function to it, may be call it "swip back to clcok SM" S for selecting swipe U/D/L/R, M for menu.
But the SM version will be a long way to go. Currently should I keep the UD version for my own and not publishing to the bangle store? however i think it do will help as it now let people can use gesture to switch back to clcok by swipe U2D and use "swipe back" Lt to Rt together.
thanks
- if it works, i would like to call it "swipe back to clock UD", later i would like to add the menu function to it, may be call it "swip back to clcok SM" S for selecting swipe U/D/L/R, M for menu.
-
hi,
- back to my main Q,
is the emulator working?
i am using the same win10 as i tested my microwave app before,
but the emulator now only shows the bangle screen,
even i type load(), it didn't enter into the system.is it something wrong at my side or is the emulator service down but i just dont read the notice?
without it i cant test the soft reboot app.....<--- an essential app just as i'll install in my android phone.thanks
- btw, let it go the chinese sms problem and put aside first,
it's true non-ASCII is a problem just as at the early days of computing.
may be hope later unicode will be implemented. and the non-ASCII input methods,
always a pain in windows, linux, android.
better everyone speaks in english.
- back to my main Q,
-
I use chinese,
when there is SMS that contain chinese, which is send to the BJv2, then weired things happen. i tried on/off /w "text to bitmap", different font sizes, different message app (default UI/list/large/overlap, XXL?) etc. no good result.when the message icon flash, it even will affect the "stop timer"s'timer count, (they flash together)
and "folder launcher"will have weired background for some app, (but desktop launcher is ok, i think that's why more ppl liked it).thanks
may be i better turn off the "text to bitmap"option, sometimes didn't work, not very useful.
some times the message is a blank page. -
-
hi,
afair, previously it will load into the wellcome screen?
currently nothing happens.btw, i would like to ask gpt4 to write me an app for soft-reboot,
is E.reboot(); the correct function/the best way close to "pressing 10s and reboot the watch"?
sometimes the clock becomes lag/slow and i wanna reboot it without using the button.thanks
-
-
-
hi, thx for suggestion.
however i found the "stopwatch touch" very attractive,
i'll rather contact the author for more info as he claimed also keen to make it into the widget, thanks