Skip to content

Commit

Permalink
fix mavlink/Windows event propogation
Browse files Browse the repository at this point in the history
  • Loading branch information
stronnag committed Feb 9, 2025
1 parent 2589345 commit d04b898
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('mwptools', 'vala', 'c', version : '25.02.08', meson_version : '>= 1.4.0')
project('mwptools', 'vala', 'c', version : '25.02.09', meson_version : '>= 1.4.0')

nogo = get_option('nogo')
force_s = get_option('force-static')
Expand Down
10 changes: 9 additions & 1 deletion src/common/serial-device.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,11 @@ public class MWSerial : Object {
stats.msgs++;
var msg = INAVEvent(){cmd=cmd+Msp.MAV_BASE, len=csize, flags=0, err=errstate, raw=rxbuf[0:csize+4]};
msgq.push(msg);
serial_event();
#if UNIX
serial_event();
#else
Idle.add(() => {serial_event();return false;});
#endif
state = States.S_HEADER;
} else {
error_counter("Mav/CRC");
Expand Down Expand Up @@ -1870,7 +1874,11 @@ public class MWSerial : Object {
stats.msgs++;
var msg = INAVEvent(){cmd=cmd+Msp.MAV_BASE, len=csize, flags=0, err=errstate, raw=rxbuf[0:csize+4]};
msgq.push(msg);
#if UNIX
serial_event();
#else
Idle.add(() => {serial_event();return false;});
#endif
if(mavsig == 0)
state = States.S_HEADER;
else
Expand Down
1 change: 1 addition & 0 deletions src/mwp/mwp-enums.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ namespace Mwp {
LOSANA, // 512
RDRLIST, // 1024
MAPS, // 2048
MAVLINK, // 4096
}

[Flags]
Expand Down
10 changes: 7 additions & 3 deletions src/mwp/mwp-mavlink_msg.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
namespace Mwp {
bool handle_mavlink(MWSerial ser, Msp.Cmds cmd, uint8[]raw, uint len) {
bool handled = true;
//MWPLog.message("::DBG:: [%x, %u] %s\n", cmd, len, cmd.format());

if((Mwp.DEBUG_FLAGS.MAVLINK in Mwp.debug_flags)) {
MWPLog.message("::DBG:: [%x, %u] %s\n", cmd, len, cmd.format());
}
switch (cmd) {
case Msp.Cmds.MAVLINK_MSG_ID_HEARTBEAT:
Mav.MAVLINK_HEARTBEAT m = *(Mav.MAVLINK_HEARTBEAT*)raw;
Expand Down Expand Up @@ -110,6 +111,9 @@ namespace Mwp {
int fix = m.fix_type;
int fvup = 0;
int ttup = 0;

fix = int.min(fix, 3);

if(m.eph != 65535) {
ser.td.gps.hdop = m.eph/100.0;
}
Expand Down Expand Up @@ -188,7 +192,6 @@ namespace Mwp {
double hlat, hlon;
HomePoint.get_location(out hlat, out hlon);
Geo.csedist(hlat, hlon, mlat, mlon, out range, out brg);

if(range >= 0.0 && range < 256) {
var cg = MSP_COMP_GPS();
cg.range = (uint16)Math.lround(range*1852);
Expand All @@ -205,6 +208,7 @@ namespace Mwp {
}
}
update_pos_info();

if(want_special != 0)
process_pos_states(mlat, mlon, dalt, "MavGPS");
if(Logger.is_logging) {
Expand Down
8 changes: 4 additions & 4 deletions src/mwp/winres.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2 ICON "../../data/mwp.ico"

1 VERSIONINFO
FILEVERSION 25,02,8,0
FILEVERSION 25,02,8,0
FILEVERSION 25,02,9,0
FILEVERSION 25,02,9,0
FILEOS 0x40004
FILETYPE 1
{
Expand All @@ -12,12 +12,12 @@ FILETYPE 1
{
VALUE "CompanyName", "Stronnag MegaCorp"
VALUE "FileDescription", "mwp"
VALUE "FileVersion", "25.02.08"
VALUE "FileVersion", "25.02.09"
VALUE "InternalName", "mwp GCS and MissionPlanner"
VALUE "LegalCopyright", "Copyright (c) 2014-2025 Jonathan Hudson"
VALUE "OriginalFilename", "mwp.exe"
VALUE "ProductName", "mwptools"
VALUE "ProductVersion", "25.02.08"
VALUE "ProductVersion", "25.02.09"
VALUE "Comments", "Licence GPL3 or later"
}
}
Expand Down

0 comments on commit d04b898

Please sign in to comment.