diff --git a/FollowMe.cfg b/FollowMe.cfg index f95c7e4..bd77b01 100644 --- a/FollowMe.cfg +++ b/FollowMe.cfg @@ -75,13 +75,13 @@ // #define WITH_VARIO #define WITH_ADSL -// #define WITH_PAW -// #define WITH_FANET +#define WITH_PAW +#define WITH_FANET #define WITH_LORAWAN #define WITH_AP // WiFi Access Point: can work together with BT_SPP #define WITH_AP_BUTTON // only starts when button pressed at sartup -// #define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link: can work together with WiFi Access point +#define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link: can work together with WiFi Access point // #define WITH_STRATUX // beta-code: connect to Stratux WiFi and serve as GPS and OGN transmitter/receiver // #define WITH_APRS // alpha-code: attempt to connect to the wifi router for uploading the log files to APRS diff --git a/flash_USB0.sh b/flash_USB0.sh index 192add1..7a8efd5 100644 --- a/flash_USB0.sh +++ b/flash_USB0.sh @@ -1,3 +1,7 @@ +# you may need to change the port name +# you may need to change python into python3 +# you may need to install pyserial python or python3 module: pip install pyserial +# you may need to install python or python3 pip: sudo apt-get install python-pip python esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset \ write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 \ build/bootloader/bootloader.bin 0x10000 build/esp32-ogn-tracker.bin 0x8000 build/partitions.bin diff --git a/main/disp_oled.cpp b/main/disp_oled.cpp index fda1a1c..7d1a9a4 100644 --- a/main/disp_oled.cpp +++ b/main/disp_oled.cpp @@ -42,7 +42,7 @@ #define STR(macro) QUOTE(macro) #ifndef VERSION -#define VERSION 0.1.5 +#define VERSION 0.1.6 #endif static char Line[128]; @@ -824,8 +824,8 @@ void OLED_DrawID(u8g2_t *OLED, GPS_Position *GPS) else { #ifdef WITH_FollowMe - u8g2_DrawStr(OLED, 15, 44, "FollowMe868"); - u8g2_DrawStr(OLED, 20, 56, "by AVIONIX"); + u8g2_DrawStr(OLED, 15, 37, "FollowMe868"); + u8g2_DrawStr(OLED, 20, 49, "by AVIONIX"); #endif } // u8g2_SetFont(OLED, u8g2_font_5x8_tr); diff --git a/main/parameters.h b/main/parameters.h index 65ff585..f13135e 100644 --- a/main/parameters.h +++ b/main/parameters.h @@ -179,6 +179,34 @@ uint16_t StratuxPort; uint8_t AppKey[16]; #endif + union + { uint16_t TxProtMask; + struct + { bool TxSpare:1; + bool TxOGN:1; + bool TxADSL:1; + bool TxPAW:1; + bool TxFNT:1; + bool TxWAN:1; + bool TxADSB:1; + bool TxODID:1; + } ; + } ; + + union + { uint16_t RxProtMask; + struct + { bool RxSpare:1; + bool RxOGN:1; + bool RxADSL:1; + bool RxPAW:1; + bool RxFNT:1; + bool RxWAN:1; + bool RxADSB:1; + bool RxODID:1; + } ; + } ; + uint32_t CheckSum; #ifdef WITH_APRS @@ -247,6 +275,8 @@ uint16_t StratuxPort; TxPower = 14; // [dBm] for RFM69HW RFchipTypeHW = 1; #endif + TxProtMask = 0xFF; + RxProtMask = 0xFF; Flags = 0; #ifdef WITH_GPS_UBX @@ -691,9 +721,15 @@ uint16_t StratuxPort; if(strcmp(Name, "GNSS")==0) { int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0; GNSS=Mode; return 1; } + if(strcmp(Name, "TxProtMask")==0) + { int32_t Mask=0; if(Read_Int(Mask, Value)<=0) return 0; + TxProtMask=Mask; return 1; } + if(strcmp(Name, "RxProtMask")==0) + { int32_t Mask=0; if(Read_Int(Mask, Value)<=0) return 0; + RxProtMask=Mask; return 1; } if(strcmp(Name, "PageMask")==0) - { int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0; - PageMask=Mode; return 1; } + { int32_t Mask=0; if(Read_Int(Mask, Value)<=0) return 0; + PageMask=Mask; return 1; } if(strcmp(Name, "InitialPage")==0) { int32_t Mode=0; if(Read_Int(Mode, Value)<=0) return 0; InitialPage=Mode; return 1; } @@ -871,6 +907,8 @@ uint16_t StratuxPort; Write_Hex (Line, "CONprot" , CONprot, 1); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF; Write_SignDec(Line, "TxPower" , TxPower ); strcat(Line, " # [ dBm]\n"); if(fputs(Line, File)==EOF) return EOF; Write_UnsDec (Line, "TxHW" ,(uint32_t)RFchipTypeHW ); strcat(Line, " # [ bool]\n"); if(fputs(Line, File)==EOF) return EOF; + Write_Hex (Line, "TxProtMask" , (uint32_t)TxProtMask,2); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF; + Write_Hex (Line, "RxProtMask" , (uint32_t)RxProtMask,2); strcat(Line, " # [ mask]\n"); if(fputs(Line, File)==EOF) return EOF; Write_UnsDec (Line, "FreqPlan" ,(uint32_t)FreqPlan ); strcat(Line, " # [ 0..5]\n"); if(fputs(Line, File)==EOF) return EOF; Write_Float1 (Line, "FreqCorr" , (int32_t)RFchipFreqCorr ); strcat(Line, " # [ ppm]\n"); if(fputs(Line, File)==EOF) return EOF; Write_SignDec(Line, "TempCorr" , (int32_t)RFchipTempCorr ); strcat(Line, " # [ degC]\n"); if(fputs(Line, File)==EOF) return EOF; @@ -942,6 +980,8 @@ uint16_t StratuxPort; Write_Hex (Line, "CONprot" , CONprot, 1); strcat(Line, " # [ mask]\n"); Format_String(Output, Line); Write_SignDec(Line, "TxPower" , TxPower ); strcat(Line, " # [ dBm]\n"); Format_String(Output, Line); Write_UnsDec (Line, "TxHW" ,(uint32_t)RFchipTypeHW ); strcat(Line, " # [ bool]\n"); Format_String(Output, Line); + Write_Hex (Line, "TxProtMask" , (uint32_t)TxProtMask,2); strcat(Line, " # [ mask]\n"); Format_String(Output, Line); + Write_Hex (Line, "RxProtMask" , (uint32_t)RxProtMask,2); strcat(Line, " # [ mask]\n"); Format_String(Output, Line); Write_UnsDec (Line, "FreqPlan" ,(uint32_t)FreqPlan ); strcat(Line, " # [ 0..5]\n"); Format_String(Output, Line); Write_Float1 (Line, "FreqCorr" , (int32_t)RFchipFreqCorr ); strcat(Line, " # [ ppm]\n"); Format_String(Output, Line); Write_SignDec(Line, "TempCorr" , (int32_t)RFchipTempCorr ); strcat(Line, " # [ degC]\n"); Format_String(Output, Line); diff --git a/main/proc.cpp b/main/proc.cpp index aef50a9..5f8141d 100644 --- a/main/proc.cpp +++ b/main/proc.cpp @@ -667,7 +667,7 @@ void vTaskPROC(void* pvParameters) static uint8_t FNTbackOff=0; if(FNTbackOff) FNTbackOff--; // if( (SlotTime&0x07)==(RX_Random&0x07) ) // every 8sec - else if(RF_FreqPlan.Plan<=1) + else if(Parameters.TxFNT && RF_FreqPlan.Plan<=1) { FANET_Packet *Packet = FNT_TxFIFO.getWrite(); Packet->setAddress(Parameters.Address); Position->EncodeAirPos(*Packet, Parameters.AcftType, !Parameters.Stealth); diff --git a/main/rf.cpp b/main/rf.cpp index 234167c..270404b 100644 --- a/main/rf.cpp +++ b/main/rf.cpp @@ -657,10 +657,10 @@ extern "C" // CONS_UART_Write('0'+ADSL_Slot); // Format_String(CONS_UART_Write, "\n"); } #endif - const uint8_t *TxPktData0=0; - const uint8_t *TxPktData1=0; - const OGN_TxPacket *TxPkt0 = RF_TxFIFO.getRead(0); // get 1st packet from TxFIFO - const OGN_TxPacket *TxPkt1 = RF_TxFIFO.getRead(1); // get 2nd packet from TxFIFO + const uint8_t *TxPktData0=0; // pointers to OGN packet data to be sent + const uint8_t *TxPktData1=0; // during the two time slots + const OGN_TxPacket *TxPkt0 = RF_TxFIFO.getRead(0); // get 1st packet from TxFIFO (NULL if none) + const OGN_TxPacket *TxPkt1 = RF_TxFIFO.getRead(1); // get 2nd packet from TxFIFO (NULL if none) if(TxPkt0) TxPktData0=TxPkt0->Byte(); // if 1st is not NULL then get its data if(TxPkt1) TxPktData1=TxPkt1->Byte(); // if 2nd if not NULL then get its data else TxPktData1=TxPktData0; // but if NULL then take copy of the 1st packet @@ -670,11 +670,11 @@ extern "C" { const uint8_t *Tmp=TxPktData0; TxPktData0=TxPktData1; TxPktData1=Tmp; } // swap 1st and 2nd packet data } #ifdef WITH_ADSL - if(ADSL_Slot==0 && ADSL_TxPkt) + if(Parameters.TxADSL && RF_FreqPlan.Plan<=1 && ADSL_Slot==0 && ADSL_TxPkt) TimeSlot(TxChan, 800-TimeSync_msTime(), ADSL_TxPkt, TRX.averRSSI, 0, TxTime); else #endif - TimeSlot(TxChan, 800-TimeSync_msTime(), TxPktData0, TRX.averRSSI, 0, TxTime); // run a Time-Slot till 0.800sec + TimeSlot(TxChan, 800-TimeSync_msTime(), Parameters.TxOGN?TxPktData0:0, TRX.averRSSI, 0, TxTime); // run a Time-Slot till 0.800sec TRX.setModeStandby(); TxChan = RF_FreqPlan.getChannel(RF_SlotTime, 1, 1); // transmit channel @@ -733,25 +733,25 @@ extern "C" #ifdef WITH_LORAWAN bool WANtx = 0; if(WAN_BackOff) WAN_BackOff--; - else if(RF_FreqPlan.Plan<=1 && Parameters.TxPower!=(-32)) // decide to transmit in this slot + else if(Parameters.TxWAN && RF_FreqPlan.Plan<=1 && Parameters.TxPower!=(-32)) // decide to transmit in this slot { if(WANdev.State==0 || WANdev.State==2) // { WANtx=1; SlotEnd=1220; } } #endif #ifdef WITH_ADSL - if(RF_FreqPlan.Plan<=1 && ADSL_Slot==1 && ADSL_TxPkt) + if(Parameters.TxADSL && RF_FreqPlan.Plan<=1 && ADSL_Slot==1 && ADSL_TxPkt) TimeSlot(TxChan, SlotEnd-TimeSync_msTime(), ADSL_TxPkt, TRX.averRSSI, 0, TxTime); else #endif - TimeSlot(TxChan, SlotEnd-TimeSync_msTime(), TxPktData1, TRX.averRSSI, 0, TxTime); + TimeSlot(TxChan, SlotEnd-TimeSync_msTime(), Parameters.TxOGN?TxPktData1:0, TRX.averRSSI, 0, TxTime); #ifdef WITH_PAW static uint8_t PAWtxBackOff = 4; #ifdef WITH_LORAWAN - if(!WANtx && TxPkt0 && TxPkt0->Packet.Header.AddrType && WANdev.State!=1 && WANdev.State!=3) // if no WAN transmission/reception scheduled + if(Parameters.TxPAW && RF_FreqPlan.Plan<=1 && !WANtx && TxPkt0 && TxPkt0->Packet.Header.AddrType && WANdev.State!=1 && WANdev.State!=3) // if no WAN transmission/reception scheduled #else - if(RF_FreqPlan.Plan<=1 && TxPkt0 && TxPkt0->Packet.Header.AddrType) -#endif + if(Parameters.TxPAW && RF_FreqPlan.Plan<=1 && TxPkt0 && TxPkt0->Packet.Header.AddrType) +#endif // WITH_LORAWAN { PAW_Packet Packet; Packet.Clear(); OGN1_Packet TxPkt = TxPkt0->Packet; TxPkt.Dewhiten(); // de-whiten the OGN packet so it can be converted to PAW format