Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 3.96 KB

DEV-HINTS.md

File metadata and controls

83 lines (56 loc) · 3.96 KB

Code layout ?

Mostly inherited it the way it is from INAV-configurator/betaflight configurator.

For the most part each of the navigation 'tabs' in the main screen has two files under tabs/ folder
eg: tabs/inspector.html and tabs/inspector.js the .html is for the initial render and kinda skeleton bits, and the .js file uses jquery heavily to add all the dynamic content and clickability and refresheses etc

Anything higher-level that's used across the whole app, or multiple tabs, such as the mavlink , serial, etc is in folder /js/*.js

Don't edit main.html ( or main-dev.html ) directly, its actually auto-generated from main.tmpl.html, if u need to do edits to this, do them to the .tmpl.html file then run 'npm run gulp build' or similar, and the main.html will be updated from the template.

MavLink replacing MSP. - you'll see a lot of references to both., and what's this 'mavsp'?

A weird convention i used is because there /was/ a library called 'MSP' that stands for multiwii-serial-protocol which i kinda implanted the mavlink into and its no-longer really capable of doing the original multi-wii serial, so it needed to be renamed. so... i called it 'mavsp'.

'mavsp' = 'mavlink + msp' its a hybrid of the two, but its really just mavlink.

js/mavsp/*.js

A bit of detail on each of these *.js:

js/mavsp/mav_compat.js - enough of an implementation of 'EventEmitter' inspired by same name from node, and same for 'util.inherits' from node, and a tiny bit from underscore.js.
just enough of a shim for mav_v2.js to work in-browser.

js/mavsp/mavFlightMode.js - convenience classs for just handling mavlink flight mode changes, mostly from mavagent/mavcontrol

js/mavsp/mavMission.js - convenience classs for just handling mavlink mission up/down, mostly from mavagent/mavcontrol

js/mavsp/mavParam.js - convenience classs for just handling mavlink parameter fetch/push, mostly from mavagent/mavcontrol

js/mavsp/MAVSPchainer.js - was originally MSP code.

js/mavsp/MAVSPCodes.js - was originally MSP code.

js/mavsp/MAVSPHelper.js - was originally MSP code.
Lots of mavlink integration hooks and stuff added here.
instantiates mav parser, senders, flight modes obj, mission obj,
processDataMav(..) is where incoming pack data all arrives and is potentially "handled",
and frontend_generic_link_sender() is where data is routed outbound from mavparser to MSP/serial
interfaces via MspMessageClass()

js/mavsp/mav_v2.js - mostly autogenerated file , from pymavlink subsystem, this is the official bindings for the MAVLink protocol implementation for node.js (auto-generated by mavgen_javascript.py), an then the module.xxx and 'reuire' lines removed for front-end.

js/mavsp/buffer-5.4.3a.js - not my code, a reimplementation of 'buffer' from node. for the browser, used by others above.

js/mavsp/local_modules/jspack/jspack.js - mostly not my code, an implementation of 'jspack' from node.
ports of the Python struct module. used by others above.

js/mavsp/local_modules/long/src/long.js - mostly not my code, a implementation of 'long' from node. used by others above.

We're not actually using any of the original MSP serial/usb protocol, its just the old protocol that was used, and i'm progressively massaging it till theres none left.

MavLink replacing MSP. - these seems to be a lot of MSP code in there thats not being used/executed any more, and is just 'dead code'.

Yep.   I'm calling it 'reference material' to help understand how it *did* work before i messed it all up with this mavlink mellarky. 

I'll go through at an appropriate time and drop all those unused bits on the floor.
    eg js/mavsp/MAVSPHelper.js -> self.processData function (1500 lines of unsed code).  
    that sort of thing. 
    Right now the focus is in minimim-viable-does-it-even-work-at-all, not 'is it pretty/good'. 
    we'll get there.