OpenStreetMap logo OpenStreetMap

Taking info from

https://www.rigacci.org/wiki/doku.php/doc/appunti/hardware/gps_logger_i_blue_747

and

https://www.technologyblog.de/2019/05/gps-rollover-zerstoert-gps-logger/

and

https://wiki.openstreetmap.org/wiki/Holux_M-241

a modified mtkbabel can set the time when reading from the device. That should probably go into some check whether it’s really a M-241 that is connected, but as long as the battery lasts the device shows the correct time again and logs tracks in this year and not dated 2006..

$ diff -u /usr/bin/mtkbabel ./mtkbabel
--- /usr/bin/mtkbabel   2019-10-12 12:23:29.000000000 +0200
+++ ./mtkbabel  2026-03-03 19:37:37.482923895 +0100
@@ -166,7 +166,7 @@
 #-------------------------------------------------------------------------
 my $debug    = $LOG_WARNING;     # Default loggin level.
 my $port     = '/dev/ttyUSB0';   # Default communication port.
-my $baudrate = 115200;           # Default port speed.
+my $baudrate = 38400;           # Default port speed.
 my $ro_weeks = 0;                # Weeks offset to fix Weeks Rollover Bug

 # GPX global values.
@@ -356,6 +356,18 @@
     set_data_types($model_id);
 }

+# Set time to work around week rollover bug
+
+my ($sec,$min,$hour,$mday,$mon,$year) = gmtime;
+
+$year += 1900;      # year is years since 1900
+$mon  += 1;         # month is 0-11
+
+packet_send(sprintf('PMTK335,%04d,%02d,%02d,%02d,%02d,%02d', $year, $mon, $mday, $hour, $min, $sec));
+$ret = packet_wait('PMTK001');
+printf "Set time string: $year, $mon, $mday, $hour, $min, $sec\n";
+printf "Return for setting time: $ret\n";
+
 #-------------------------------------------------------------------------
 # Erase memory.
 #------------------------------------------------------------------------- 

Discussion

Log in to leave a comment