• Was hacking about with s7clk.app.js
    I commented out the date and seconds display code and uploaded as s7clk.app.js
    Now when I try and run the app I get an exception.
    I reuploaded the original app.js back to s7clk.app.js but still get the same exception.

    Where do these fonts live on the watch ?

    Also wondering how the 7*6 works in the code.
    It looks like you are scaling the x,y to work across bangle 1 and 2 but not sure what is going on here.

      var size = Math.floor(g.getWidth()/(7*6));
      var x = (g.getWidth()/2) - size*6;
      var y = (g.getHeight()/2) - size*7;
    
  • Sat 2021.08.28

    http://www.espruino.com/modules/Font7x11­Numeric7Seg.js

    How I got there. Typing 'Fonts' into the Search field at the upper right of most Espruino pages

    http://www.espruino.com/Fonts

    Noting that right clicking on almost every listed font takes one to:

    http://www.espruino.com/modules/

    Searching that list finds the desired Font7x11Numeric7Seg font

    http://www.espruino.com/modules/Font7x11­Numeric7Seg.js

    Another useful article

    http://www.espruino.com/Bangle.js+Clock+­Font

  • Thanks for the links. Still not sure what is going on here. Once minute the app worked. The next after editing, it failed and then when replaced with the unedited version it fails again. There is no Font7x11Numeric7Seg.js file on the device as far as I can tell and I cant see anything that would cause it to be installled. It feels like the App Loader does something behind the scenes to make the module somehow available that is not being done when you edit the s7clk.app.js file and upload a change. Following the fonts links - it say all you need to do is type:

    require("Font7x11Numeric7Seg").add(Graph­ics);
    

    But this fails in the IDE and in the App.
    Had a look in the Fonts tutorial and the example embeds code in the app for the font.
    But in the case of s7clk there is no code for the font.

  • Sun 2021.08.29

    Module statements are to be included in the code that is uploaded when entered in the R-Hand editor pane of the IDE. By chance is the require statement being entered into the L-Hand console side?

    https://www.espruino.com/FAQ
    Heading 'How do modules work?'

    https://www.espruino.com/Troubleshooting­
    Heading 'I've pasted code into the left-hand side of the Web IDE and it doesn't work'

  • Here's what I did.

    Checkout the latest code from
    https://github.com/espruino/BangleApps/a­pps/s7clk/app.js
    Upload app.js through the IDE , click on the storage icon, navigate to file, change name to 7clk.app.js.

    Restart the s7clk App and it will fail ?

    // this works on the Right hand side of the IDE , if you send it to RAM
    // but wont work in the actual app.js file
    require("Font7x11Numeric7Seg");
    

    The App loader does something secret in the background to add the font module into the source file that is mimised - maybe ?

    I have also uploaded the Font7x11Numeric7Seg.js file onto the bangle and this makes no difference. The only way that the App will work is if its installed through the App Loader or Run in RAM. If you edit the code and upload to storage it stops working and gives this exception.

  • The App loader does something secret in the background to add the font module into the source file that is mimised - maybe ?

    Yes, that's correct - but the IDE should do this too - unless you have some kind of internet connection issues? You could check the console in the IDE to see if it failed...

    I have also uploaded the Font7x11Numeric7Seg.js file onto the bangle and this makes no difference

    Upload to a file called just Font7x11Numeric7Seg - but again that shouldn't be needed.

    var size = Math.floor(g.getWidth()/(7*6));

    It's just trying to leave enough room for 6 characters of width 7 pixels along the screen width.

  • but the IDE should do this too

    It works if the code is loaded into the right hand side window of the IDE and upload to RAM. I'm uploading the js file through the IDE by clicking the STORAGE icon and selecting Upload File into the storage on the device. Then I got an run the modified App from the launcher. I guess this must bypass the way modules are designed to work.

  • I guess this must bypass the way modules are designed to work.

    It doesn't though - you can check (I just did)...

    • Put require("Font7x11Numeric7Seg"); on its own in the RHS of the IDE
    • Click the 'upload' drop-down, choose Storage, New File, and enter test as the filename
    • Upload
    • Click the Storage icon, scroll down to test and click the eye icon

    You'll see the module is actually loaded directly into that file.

  • Yes that works.
    But what I am doing is

    • writing test on my Chromebook storage.
    • Clicking the FileSystem icon in the IDE
    • Selecting upload file.
    • Navigate to the file on the hard disk, select the file
    • Change the name to test
    • Upload it to the Bangle
    • Then open the IDE FileSytem to browse the files.
    • Look at the file 'test' and all it has in it is 'require("Font7x11Numeric7Seg"); '

    Now if I attempt to run that file from the Run option it causes the exception.

    I tend not to use the RHS of the IDE as its faff to save my work to disk all the time as it can only download to code.js. So tend to edit in Emacs and then load the changed file through the IDE.

  • Ahh, right! I've never heard of anyone doing that before!

    What happens when you click 'upload' via storage is it just copies the file without any processing.

    When you update from the right hand side it does quite a few transformations (including loading modules).

    What I'd suggest is (and I think this'll work on Chromebook), the recent IDEs on https://www.espruino.com/ide/ should have a drop-down next to 'open' - click that and do 'Watch and Upload'. Now you can edit in Emacs and every time you save it'll re-upload

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Uncaught Error: Module Font7x11Numeric7Seg not found

Posted by Avatar for HughB @HughB

Actions