After many hours of trying I had to realize that I should spend on lot of time to learn the programming basics properly, and figure out how multiwii code works. In lack of this it is almost impossible to do finalize my idea. But also I think it would be 2-3 afternoon job for somebody who knows what to do, since even I had some success on i2c communication establisment between the two arduino panels (with some test modifications, I was able to turn on the LED of the secondary Arduino with an aux input of multiwii.....
), but I can't figure out how to read the data and import into the MW code properly, etc...So here is the clear and final idea again, I wish somebody could do the programming job for the MWI community who uses Mini based boards...: // legends: PRA - primary arduino with MW code, SEA - secondary arduino with GPS connected
- SEA and PRA are connected with i2c, SEA and GPS with serial
- SEA establishes serial communication with the gps and reads out GGA strings on 115200 baud (I have to use VTG too for my OSD because of airspeed, so the program should be able to read the GGA only from two type of sentences)
- SEA translates latitude, longitude, fix, satellite number values, and update these values continously if fix is OK (else leaves them unchanged)
- SEA learns home and hold coordinates and continously calculates the distance and direction between current position and home and hold coordinates (at initialization both should be the first fix, then changing regarding the followings)
- if PRA would read SEA, distance and direction to home; fix and numsat are available in 10 bytes from SEA. (fix 1byte, numsat 1 byte, distToHome 2 bytes, dirToHome 2 bytes, distToHold 2 bytes, dirToHold 2 bytes)
- I plan to put home position learning onto a spring-switch on my radio, so when spring state of switch is active in PRA, PRA asks SEA to learn the home position coordinates, but it could be linked to arming too.
- every time hold mode becomes active in PRA, it sends an order to SEA for learning the current position as hold. It is important to send the command only once per hold activation.
- PRA only uses the datas from SEA for positioning (distance, direction) to reduce PRA code size
- I think, for safety in both hold and home functions there should be a condition for fix=1, so when there is GPS fix, they are working, when fix takes away, hold and home deactivates, and copter stays in autolevel, and once fix returns, copter continues the way if option is still enabled.
- I think for both home and hold functions the same algorythm should used for first time since the task is almost the same, stay as close to the desired point as possible).
- as an addition, SEA led should light up when fix is OK (only some lines in code but great help for checking if GGA sentences are translated properly)That's all folks!
ps.: sorry for my english, I'm not using the language daily...
, and many thanks to EOSBandi for the basic idea...