From 8781688e3754466fcf4066e0a746b13c2c11efa8 Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Tue, 1 Sep 2020 20:19:27 +0100 Subject: [PATCH] Add WiFi power and sensitivity control for Stratux. more flexible TCP connection target --- main/parameters.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/main/parameters.h b/main/parameters.h index b5edec2..7a2daf4 100644 --- a/main/parameters.h +++ b/main/parameters.h @@ -110,6 +110,10 @@ class FlashParameters #ifdef WITH_STRATUX char StratuxWIFI[32]; char StratuxPass[32]; + char StratuxHost[32]; + uint16_t StratuxPort; + int8_t StratuxMinSig; + int8_t StratuxTxPwr; #endif #ifdef WITH_WIFI @@ -218,6 +222,10 @@ class FlashParameters #ifdef WITH_STRATUX strcpy(StratuxWIFI, "stratux"); StratuxPass[0] = 0; + StratuxHost[0] = 0; + StratuxPort = 30011; + StratuxMinSig = -70; // [dBm] + StratuxTxPwr = 40; // [0.25dBm] #endif #ifdef WITH_WIFI for(uint8_t Idx=0; Idx0xFFFF) Port=30011; StratuxPort=Port; return 1; } + if(strcmp(Name, "StratuxMinSig")==0) + { int32_t MinSig; if(Read_Int(MinSig, Value)<=0) return 0; + if(MinSig<=(-90)) MinSig=(-90); + if(MinSig>=0) MinSig=0; + StratuxMinSig=MinSig; return 1; } + if(strcmp(Name, "StratuxTxPwr")==0) + { int32_t TxPwr; if(Read_Float1(TxPwr, Value)<=0) return 0; + TxPwr=(TxPwr*4+5)/10; + if(TxPwr<=0) TxPwr=0; + if(TxPwr>=80) TxPwr=80; + StratuxTxPwr=TxPwr; return 1; } #endif #ifdef WITH_WIFI if(strcmp(Name, "WIFIname")==0) return Read_String(WIFIname[0], Value, WIFInameLen)<=0; @@ -649,6 +672,10 @@ class FlashParameters #ifdef WITH_STRATUX strcpy(Line, "StratuxWIFI = "); strcat(Line, StratuxWIFI); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF; strcpy(Line, "StratuxPass = "); strcat(Line, StratuxPass); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF; + strcpy(Line, "StratuxHost = "); strcat(Line, StratuxHost); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF; + Write_UnsDec (Line, "StratuxPort" , (uint32_t)StratuxPort ); strcat(Line, " # [port]\n"); if(fputs(Line, File)==EOF) return EOF; + Write_Float1(Line, "StratuxTxPwr" , (int32_t)10*StratuxTxPwr/4); strcat(Line, " # [ dBm]\n"); if(fputs(Line, File)==EOF) return EOF; + Write_SignDec(Line, "StratuxMinSig", (int32_t)StratuxMinSig); strcat(Line, " # [ dBm]\n"); if(fputs(Line, File)==EOF) return EOF; #endif #ifdef WITH_WIFI for(uint8_t Idx=0; Idx