@@ -238,4 +238,42 @@ TEST(ports, boot_pxx1_multi)
238
238
_deinitModuleDrv (EXTERNAL_MODULE);
239
239
EXPECT_FALSE (modulePortIsPortUsed (ETX_MOD_PORT_SPORT));
240
240
}
241
+
242
+ TEST (ports, isTelemAllowedOnBind)
243
+ {
244
+ modulePortInit ();
245
+
246
+ void * int_ctx = Pxx1Driver.init (INTERNAL_MODULE);
247
+ EXPECT_TRUE (int_ctx != nullptr );
248
+ if (!int_ctx) return ;
249
+ _setModuleDrv (INTERNAL_MODULE, &Pxx1Driver, int_ctx);
250
+
251
+ // Telem always has priority on internal
252
+ EXPECT_TRUE (isTelemAllowedOnBind (INTERNAL_MODULE));
253
+
254
+ // When internal uses SPORT, you cannot bind FRSKY with telem on external module
255
+ EXPECT_FALSE (isTelemAllowedOnBind (EXTERNAL_MODULE));
256
+
257
+ // but you can when internal is disabled
258
+ _deinitModuleDrv (INTERNAL_MODULE);
259
+ EXPECT_TRUE (isTelemAllowedOnBind (EXTERNAL_MODULE));
260
+ }
261
+ #elif !defined(PCBFLYSKY) // defined(INTERNAL_MODULE_PXX1) && defined(HARDWARE_EXTERNAL_MODULE)
262
+ TEST (ports, isTelemAllowedOnBind)
263
+ {
264
+ modulePortInit ();
265
+
266
+ const etx_serial_init serialCfg = {
267
+ .baudrate = 921000 ,
268
+ .encoding = ETX_Encoding_8N1,
269
+ .direction = ETX_Dir_TX_RX,
270
+ .polarity = ETX_Pol_Normal,
271
+ };
272
+
273
+ auto mod_st = modulePortInitSerial (INTERNAL_MODULE, ETX_MOD_PORT_UART, &serialCfg, false );
274
+ EXPECT_TRUE (mod_st != nullptr );
275
+
276
+ // Since internal module doesn't use SPORT, you should be able to bind FrSky with telem
277
+ EXPECT_TRUE (isTelemAllowedOnBind (EXTERNAL_MODULE));
278
+ }
241
279
#endif
0 commit comments