diff --git a/companion/releasenotes.txt b/companion/releasenotes.txt index fd46126be..822da7a75 100644 --- a/companion/releasenotes.txt +++ b/companion/releasenotes.txt @@ -13,6 +13,7 @@
  • Added simulator volume gain setting (#2260)
  • Added GPS glitch filtering and Latitude/Longitude position synchronization to Google Earth export (#2326)
  • Fixed a rare program crash when editing Input for 9X radio (#2420)
  • +
  • Fixed missing RSSI audio warnings if simulator was started multiple times (#2446)
  • diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 12bfd96f0..282eba7c4 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -412,7 +412,21 @@ void StartMainThread(bool tests) pthread_mutex_init(&audioMutex, NULL); #endif - g_tmr10ms = 1; // must be non-zero otherwise some SF functions (that use this timer as a marker when it was last executed) will be executed twice on startup + /* + g_tmr10ms must be non-zero otherwise some SF functions (that use this timer as a marker when it was last executed) + will be executed twice on startup. Normal radio does not see this issue because g_tmr10ms is already a big number + before the first call to the Special Functions. Not so in the simulator. + + There is another issue, some other function static variables depend on this value. If simulator is started + multiple times in one Companion session, they are set to their initial values only first time the simulator + is started. Therefore g_tmr10ms must also be set to non-zero value only the first time, then it must be left + alone to continue from the previous simulator session value. See the issue #2446 + + */ + if (g_tmr10ms == 0) { + g_tmr10ms = 1; + } + #if defined(RTCLOCK) g_rtcTime = time(0); #endif