I started diving into ESP32 and MongooseOS back here.
my first application attempt was realtively painless
ESP32 and Mongoose OS - First Application
It all seemed too easy until I struck some unexplained issues
ESP32 and Mongoose OS - Issues
Now that I have discovered the problem was with the application, I tried importing another temperature application.
I'm rather happy to report that this one worked flawlessly.
So I haven't broken any hardware, my drivers are fine, and it works as it should.
Other niggles
The OS is still a WIP (Work in Progress) as evidenced by the documentation showing a different layout than my version.
I'm not sure the error handling works as well as it could, but it is a free resource, and we can expect some issues.
What we need to understand is how to overcome these hurdles when we strike them.
I have managed to get the OS to not communicate with the device, and then get itself bitter and twisted.
The above message is typical if the device is unplugged, the device info shows it has no idea.
Simply click on the ComPort and then Select and Done.
you may also need to press the reset button on the device
However I have still witnessed some other weird messages with the comment about starting mos ui using the terminal.
Usually a refresh of the browser and reset of the device seems to sort these out, and if not an unplug and replug the USB seems to sort it.
Eventually I figure out what I'm doing wrong.
File System
I have struck an issue where an import won't work
It seemed to think there was a copy already, and no matter what I did, I could not import it.
The files are stored locally at
C:\Users\xxxxxxx\.mos\apps-1.23 (where xxxxxxxx represents your username)
Personally I do not like programs that don't allow you to decide where they reside.
If someone was using a small SSD boot drive, then it wouldn't take long for these type of Apps to fill it.
There might be some way of shifting it ... I just haven't found it yet.
Here there is 5 apps.
which nicely lines up with the OS
In the situation where it refused to Import, there was a directory in the .mos directory, that the OS didn't know about for whatever reason.
Deleting it, allowed the Import to work, but obviously any alterations you've made will be deleted.
I would recommend keeping a copy of your own somewhere else (see below on replacing it)
Opening up the directories will show that a build has taken place for example-arduino-onewire-c and Weather
So this means we can flash them to the Device without having to go through a build process.
BUT if you want to make changes to main.c or some library, then you'll need to rebuild the App.
I'm guessing this is common sense to anyone more used to this type of programming, but if like me you've come from Arduino where the build happens after you hit Upload, it will seem foreign.
Build Process
The documentation gives some insight into the process of a build.
https://mongoose-os.com/docs/book/build.html
The info under 'Build Process deep dive' gives how it works, but I think it could be better explained if this is going to be the next Arduino IDE.
I've removed all the extra bits to arrive at my view of the process :-
When the build command is executed, the following happens:
mos scans libs: section of the mos.yml file and imports all libraries into the libs directory.
Each library also has mos.yml file, and a library could have a libs: section as well, mos imports all dependent libraries too, recursively.
When all required libraries are imported, mos executes git pull in each of them, in order to update. At this point, all required libraries are imported and updated.
mos combines app's mos.yml files together and the application's mos.yml has the highest priority.
mos packs source and filesystem files and sends them to the Mongoose OS cloud build backend at http://mongoose.cloud, which performs an actual build, and sends back a build/ directory with built build/fw.zip and artifacts.
Generated artifacts in the build/ directory is as follows:
- build/fw.zip - a built firmware
- build/fs - a filesystem directory that is put in the firmware
- build/gen - a generated header and source files
New Apps
There is a bit of documentation reagrding new apps at
https://mongoose-os.com/docs/book/build.html
my version does not seperate and show my Libs, but rather it looks like this.
Clicking on New brings up a dialogue box.
While I did build the Weather app using this method, it will work for a build from scratch approach.
Importing
BUT if you're like me and found someone elses App on Github, I haven't found a great way to import that.
I did discover that you can download it, extract it, and drop it into the apps-1.23 directory.
Hit refresh on the MongooseOS browser and it will appear.
You can also copy a directory, paste it into the apps-1.23 and refresh the gui.
Personally this might be the better way to copy a blank App.
Set it up as you want, then save the files, and copy the directory ready to use each time.
Naming
You may have noticed that the name of the project appears along with the description.
This is in the mos.yml file
You can change it with your favourite editor, or with the gui, and then save.
The name is also part of the flash, as shown in my earlier work.
The example I used had mjs-latest as the name, which also shows in the title bar.
So hopefully that has filled in a few blanks.
I'm learning how to get this to work, or maybe it's teaching me, but either way the progress is less frustrating.
If only my java coding was heading in the same direction.
Mark
Previous