Closed rush0815 closed 1 year ago
There is already logic in there to automatically detect the baud rate. It will open the port at different baud rates, read for a bit, and check if we got some useful NMEA. See e.g. here how it is used: https://github.com/b3nn0/stratux/blob/e2b60736c41e60498bbe93d6309d25307096e8ee/main/gps.go#L245 The code will then trial all baud rates in that array. Feel free to create a PR using the same logic for UART GPS to try the most common ones (e.g. 9600, 38400, 57600 and 115200 or something) - I'll happily merge it if that works for you.
EDIT: Looks like detection is done after trying to send commands to it, assuming that we initially know the baud rate.. Feel free to change that a bit.
Thanks for your respond... so that will be the point where I will introduce myself into golang and github usage (not only download) :-D
I checked the line you referred to and got a bit confused now:
Since I am new to Go, can you please give me a hint where I can find the variable assignment for the values that are shown on the webUI, for example {{ConnectState}}, please?
I would try the two following changes:
if (globalStatus.GPS_detected_type == GPS_TYPE_UBX9) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) {
} else if globalStatus.GPS_detected_type == GPS_TYPE_UBX8 {
baudrates = []int{115200, 57600, 38400, 9600}
change line 311 to: if (globalStatus.GPS_detected_type == GPS_TYPE_UBX9) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { change line 317 to: } else if globalStatus.GPS_detected_type == GPS_TYPE_UBX8 {
Not for the PR though.. I think Ublox 8 is still much more dominant than 9 - and I don't want to break it for existing users. We are not able to detect if it's 8 or 9 via UART (at least not in a simple way). So for the upstream code base, this should stay at 8, at least for now.
after line 252 insert: baudrates = []int{115200, 57600, 38400, 9600}
This is the only change required to make it work. However, in line 264, the serial port is opened with baudrates[0] for configuration (including potentially changing the baud rate of the connected device). Later, in line 403 it is then re-opened with auto detection.
I'd recommend potentially changing like 264 to auto-detection as well, so your GPS will be configured properly.
Since I am new to Go, can you please give me a hint where I can find the variable assignment for the values that are shown on the webUI, for example {{ConnectState}}, please?
This is handled by angularJS in the UI itself. Check the plates-subidirectory. Each "plate" has it's HTML and its JS file providing the values of the template variables.
What is the root password to connect via ssh to stratux? I am always getting a Permission denied
It is a normal RaspiOS, so no root password is set. Use sudo to set one. Login with pi/raspberry.
ok, setting root password worked. But installint the GO Pack on stratux fails with that:
Any ideas ?
Trying to run go env directly on stratux results in:
root@stratux:~/go/bin# /root/go/bin/go env -bash: /root/go/bin/go: cannot execute binary file: Exec format error
For me it looks like VSC tries to install an x64 environment and not ARM EDIT: I accidently installed the AMD not ARM version :-/ trying again ...
See here for a proper dev setup https://github.com/b3nn0/stratux/wiki/Developing-Stratux
I changed the order of GPS init to first detect the correct baud rate and then reprogram the module and committed the changes already. But I cant see any Pull Request on github. Any idea what I am doing wrong?
Btw: where does log.Printf("ublox 9 detected\n") print to? Any logfile? I could not find all the printings anywhere....
To create a Pull Request, you need to
Here the long version...: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests
I changed the order of GPS init to first detect the correct baud rate and then reprogram the module
Keep in mind that auto-detection needs to happen before and after reconfiguration, because Stratux tries to change the baud-rate for some GPS devices. And they should always connect, even if reconfiguration fails for some reason.
Btw: where does log.Printf("ublox 9 detected\n") print to
The normal log file when you click on logs in the web interface.
This particular one is inside an if globalSettings.DEBUG
. So it will only print if you enable debug logging in the settings. And of course only if an Ublox 9 is actually detected - and detection only works via USB, so you will not see that for now.
Solved by #209
Stratux version: stratux-v1.6r1-eu028-32d5e58b.img
Stratux config:
SDR
GPS
AHRS
power source: 3A 5.2V Adapter (original Raspberry Pi adapter)
EFB app and version: (FroeFlight)
Description of your issue:
I am trying to get the NEO-M9N module working on the raspberry UART pins. Looking at gps.go line 317, every GPS module connected to the UART will be treated as an u-blox 8 module.
Since the GPS module is located on the dev board, the native USB port is made plugable so I can change the baudrate of the GPS module to 9600 to bring it up in stratux. Btw. line 319 in gps.go says:
log.Printf("ublox 8 detected\n")
where to find this log message? I assumend it should be written in stratux.log but I cant find that line.
So back to the workaround: Setting the baudrate via u-center is tricky when I use a OEM module because there is not hardware "around it" to which I connect.
The question / feature request is:
What about implementing a flexible baudrate setting and GPS Module setting into the web UI ? (only for handling UART connected modules) to make it possible to handle u-blox modules connected to UART equal to the same one connected to USB port