-
-
Hi,
I have an app that now uses 7 custom fonts. The font is selected from a settings menu.
So I only need one active font to be loaded when the App starts up.At the moment I have 7 seperate font functions that really bloat the App in terms of memory footprint.
I guess I should really just load the one font I need from storage for the lifespan of the App.Just trying to get my head round how I physically do this - what code goes where and how it is loaded.
Graphics.prototype.setFontArchitect = function() { // Actual height 40 (41 - 2) var widths = atob("CBolByEeJykkJCYhCg...=="); var font = atob("AAAAAAAAAAAAAAMAAAAAAAAAAAAA....="); var scale = 1; // size multiplier for this font g.setFontCustom(font, 46, widths, 58+(scale<<8)+(1<<16)); };
Would you recommend that I create a module for each of these fonts that basically does something similar to:
https://www.espruino.com/modules/FontDylex7x13.js
How do I tell the apps.json file that the code has 7 custom font files ?
I think the answer is the way that modules are loaded - example gpssetup
The module file drops the .js from the source file name.
Then the App does require("myfont");"storage": [ {"name":"gpssetup","url":"gpssetup.js"},
Then I think I would just load settings at the top of the code and run this bit of one time code for the lifetime of the App.
if (settings.font == "Architect") require("f_artitect").add(Graphics); else if (settings.font == "GochiHand") require("f_gochihand").add(Graphics); else if (settings.font == "CabinSketch") require("f_cabin").add(Graphics); else if (settings.font == "Orbitron") require("f_orbitron").add(Graphics); ...
-
-
@Numerist - what an interesting clock. Be interesting to see how an analogue version looked.
I tried it on my Bangle 1. I have noticed that the screen sometimes goes black before the LCD times out.
-
Thought I would add some comments to help understanding the code.
I also added a couple of console.log() calls to print messages to the IDE.
If you connect to the IDE you should be able to see some messages when the code runs
This will tell you if it was able to extract the time from the GPS chip real time clock circuit.setInterval(function() { // this is defines the GPS call back function Bangle.on("GPS",function cb(g) { Bangle.setGPSPower(0,"time"); // we got a response so turn off GPS power Bangle.removeListener("GPS",cb); // unregister the callback function if (!g.time || (g.time.getFullYear()<2000) || (g.time.getFullYear()>2200)) { // GPS receiver's time not set console.log("GPS real time clock is not set, use GPS info and get a fix"); } else { // We have a GPS time. Set time var t = g.time.getTime()/1000; setTime(t); console.log("time set to " + t); } }); // this is the end of the GPS callback funtion Bangle.setGPSPower(1,"time"); // power the GPS on, when GPS responds, callback is called }, 60*60*1000); // run this once per hour, 3600 seconds in milli-seconds
But I can see that you added this code to your app ages ago.
Really interesting discussion regarding the accuracy of the RTC chip verses the one in the GPS. -
-
Just updated to fw 2.10.114 and can see that @Gordon has changed the system font for the menu's. Here is what the settings app now looks like. Much easier to read. My preference would be still be the 6x8 x2, but the new solution also works for me.
-
The standard 6x8 scaled at 2 is actually quite an acceptable font for the menus in settings.
- thick enough to read
- thin enough not to look blotchy
- produces 6 lines instead of 8 per screen
- the font is already available as a system font
- nicer than the other samples that were demo'd above (in my opinion)
- its pretty close to some of the X11 fonts.
If this is what had been used on the B2 when I had first seen it I dont think it I would have noticed any usuability issues.
To make some of the menu text shorter,
App/Widget Settings => App Settings
- thick enough to read
-
I forgot Sinclair ZX80 was monochrome.
I bitterly could never afford such a machine, and feel loss that I never had the chance of a mispent youth. Kudos to any brave kid who saved up spent the money and soldered their machine. The first real computer I owned was a 1990 Dell 286, could at a pinch run Windows 3. -
@Robin - you did have it bad.
Never mind, I remember cross compiling for a 6801 board on an IBM 370, and a v52 terminal. -
I've managed to get toucher working on a Bangle 2.
Made a few tweaks and changes and thought I would run them past people in this forum before doing a pull request. The main thing is I have removed the version information on a 2nd line. Basically this makes the UI less cluttered.
On B2 the icons look really nice now in toucher.
Let me know what you think.To give it a try install toucher through the IDE. Then upload the file below as toucher.app.js.
Then use File Manager to load toucher.app.js -
-
Black, White, Red, Green, Blue, Cyan, Yellow, Magenta
https://en.wikipedia.org/wiki/List_of_monochrome_and_RGB_color_formats#3-bit_RGBThis is what we used to use in the late 1970s when those first computers first came out.
Try telling that to the kids of today and they wont beleive ya. -
No 3 from the top - but with a font height of 20 so that you get 6 options per screen. As shown it looks like you would still get 8 options which is too small. However it looks more readable than the existing font for showMenu();
Its not easy finding a font that works and looks nice. I have just spent a couple of hours trying out various ones on fonts.google.com. The problem is that 300 fonts come out too spidery and weedy, where as regular 400 fonts come out thick and blotchy.
I have tried out most of these but they all look very similiar at 400.
https://www.justinmind.com/blog/best-font-mobile-app-design/Attached is my hackemnu.js code.
test code I am using once that is installed is:var hackmenu = eval(require("Storage").read("hackmenu.js")); var m = { "" : { "title" : "Settings" }, "Make Connectable" : function() { LED1.set(); }, "App/Widget Settings" : function() { LED1.reset(); }, "BLE" : function() { LED1.set(); }, "Debug Info" : function() { LED1.reset(); }, "Beep" : function() { LED1.set(); }, "Vibration" : function() { LED1.reset(); }, "Quiet Mode" : function() { LED1.reset(); }, "Locale" : function() { LED1.reset(); }, "Exit" : function() { }, // nothing for now }; hackmenu(m);
-
-
-
-
There are various Apps that are very slow when working out the number of records etc (eg GPS Logger, Accellog) as they have to read through the entire file.
Wondering if one of the kickstarter improvements could be a ability to read segments of a StorageFile by offset. Currently to get the last line or the record count of a large file you have to read the whole file back. The StorageFile system would have to keep track of file length somehow to do this.
-
-
The previous version of findphone printed a newline but it didn't make any difference.
When I encountered this issue I tested against the settings app and found the same issue and that the presence of the "\n" made no difference in findphone and was not present in the settings app version.
I only have 3 clocks installed, wave s7clck and pastel. Non have console.log in them.
I wonder if anyone else has noticed this ?
-
OK, I have renamed time_t to sc_time_t so it doesn't conflict with linux time_t. Try pulling.
Thanks - can confirm compiles without error now.
Thanks to work on the harness - its great to have 2 algorithms to compare.
Are you going to write a brief for your students ?
Pointers I would give them would be:- Use 1 .c file and one .h file and a simple make file.
- Do not over engineer the stages using fancy queues, buffers, message passing etc
- Use the int_sqrt() function as that is what the embedded devices will mostly have to use.
- avoid large arrays.
- Add lots of comments to explain how the code works.
- If you use some statistical symbol / concept make sure you reference to a site that explains it clearly - ie don't just say /* using black's algorithm */
- Avoid fancy Computer Science terminology like 'single directed graph - instead use plain english like - tree structure'
- Testing should prove good accuracy when walking for long periods (not just short bursts) and non stepping use cases such as sleeping. driving, sitting at a desk, watching TV - for an hour of such activities we want sub 10 steps to be logged.
As a general aim I think we should try to have something as good as an average fitness tracker.
Agree. I would like to get to a consistant 2% within control on walking and 200 steps across the day on non stepping activities. 200/10000 steps is 2%. Still a long way from the later.
I have a 1 hour train journey tomorrow so going to try an capture a log just sitting on a train - 0 steps.
In the end it depends on the use case.
I've had a few fitness bands / watches over the years. The most common use case for me and most people I know who use them is just monitoring that you are getting your 10,000 steps per day in. For training / running and anything that needs split second and distance accuracy you have to use GPS - I would see the Bangle Run app fulfilling that niche - if its made to work well.
3hz is within slow running pace, approx 12 mins per mile.
See the table I produced for this. http://forum.espruino.com/conversations/359542/?offset=75There is a fundemental limit on what we can do with the Bangle with a 12.5hz sample time and 3hz low pass filter. The effectiveness of the LPF is constrained by the sampling rate.
- Use 1 .c file and one .h file and a simple make file.
-
@johan_m_o - thats brilliant. I've found them to be quite accurate for walking and non walking
activities. EG - my Fitbit Charge HR records about 20 steps overnight during a sleep period, non while driving and about 2000 steps per mile which is spot on for my stride length. So I trust them as something to measure against. At this stage a few steps over/under on the control is neither here nore there in terms of testing. We are sill a long way off that kind of accuracy.The method I use is:
- note START step count on control device.
- not START step count on Bangle
- start the logging
- start walking - I usually walk the dog for a couple of miles
- stop walking, stop the logger
- when stopped not END counts of bangle / control device
When you upload the file looks like we have agree'd a filename format like:
1234_Name_Activity_bYYYY.csv
Where 1234 is the control step count.
bYYYY is the Bangle step count (2.10.27 firmware or greater)
Name - your name
Activity - walking, sitting, sleeping, driving, tv-sitting, typingI install the active Pedometer Widget and set the display to large digits so I can see what the step count is.
I'd be happy to checkin the logs into the various repo's if you are not used to git etc.
- note START step count on control device.
-
@Gordon - any idea's on this one. When you go into settings / app / gadgetbridge / find phone - you have to select ON twice before the phone starts ringing. Its as if the first event is somehow lost.
-
Did you try checking what Gadgetbridge sends for an actual call received on the phone?
I did. I get 2 call events logged, but both have a blank cmd string.
I assume the first is the incoming call notification and the 2nd is the missed call ?http://forum.espruino.com/comments/16201584/
Could it be a combination of the phone and Gadgetbrige ?
@Gordon - think now would be a good time for the Wiki. I have never done a docs update and the lifecycle of maintaining a git repo and doing pulls /merge / push etc is too much overhead for what could be done in minutes on a wiki. I think write access would have to be granted on the basis of those you trust to do updates etc AND anyone could request write access if they want to contribute.