From 9aed5d7e7b3c7bf09da712e9c272ece401a7acc9 Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期一, 25 十一月 2024 14:51:23 +0800
Subject: [PATCH] add UltraSonic and MultiWireLess

---
 Radio_LLCC68/Radio/src/sx126x.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Radio_LLCC68/Radio/src/sx126x.c b/Radio_LLCC68/Radio/src/sx126x.c
index 3c375a4..c9160d1 100644
--- a/Radio_LLCC68/Radio/src/sx126x.c
+++ b/Radio_LLCC68/Radio/src/sx126x.c
@@ -430,7 +430,7 @@
         ImageCalibrated = true;
     }
 
-    freq = ( uint32_t )( ( double )frequency / ( double )FREQ_STEP );
+    freq = ( uint32_t )	( frequency * 4 / 15625 * 4096 );			// ( ( double )frequency / ( double )FREQ_STEP );
     buf[0] = ( uint8_t )( ( freq >> 24 ) & 0xFF );
     buf[1] = ( uint8_t )( ( freq >> 16 ) & 0xFF );
     buf[2] = ( uint8_t )( ( freq >> 8 ) & 0xFF );
@@ -509,13 +509,13 @@
     {
     case PACKET_TYPE_GFSK:
         n = 8;
-        tempVal = ( uint32_t )( 32 * ( ( double )XTAL_FREQ / ( double )modulationParams->Params.Gfsk.BitRate ) );
+        tempVal = ( uint32_t )( 32 * XTAL_FREQ / modulationParams->Params.Gfsk.BitRate  );
         buf[0] = ( tempVal >> 16 ) & 0xFF;
         buf[1] = ( tempVal >> 8 ) & 0xFF;
         buf[2] = tempVal & 0xFF;
         buf[3] = modulationParams->Params.Gfsk.ModulationShaping;
         buf[4] = modulationParams->Params.Gfsk.Bandwidth;
-        tempVal = ( uint32_t )( ( double )modulationParams->Params.Gfsk.Fdev / ( double )FREQ_STEP );
+        tempVal = ( uint32_t )( modulationParams->Params.Gfsk.Fdev * 4/ 15625 * 4096);  //( double )modulationParams->Params.Gfsk.Fdev / ( double )FREQ_STEP
         buf[5] = ( tempVal >> 16 ) & 0xFF;
         buf[6] = ( tempVal >> 8 ) & 0xFF;
         buf[7] = ( tempVal& 0xFF );

--
Gitblit v1.9.1