From 22c580fad685e6553a3d54c79680106100d7d121 Mon Sep 17 00:00:00 2001 From: tuxphone <67556506+tuxphone@users.noreply.github.com> Date: Sun, 27 Sep 2020 19:33:25 +0200 Subject: [PATCH] Update main.cpp --- src/main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 991ed13..fcaa48c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,7 +4,7 @@ // CONFIGURATION: change values in config.h ! #define VERBOSE // define to SILENT to turn off serial messages -#define BLINK // define to NOBLINK to turn off LED signaling +#define NOBLINK // define to NOBLINK to turn off LED signaling MeshPacket thePacket; ChannelSettings ChanSet; @@ -33,8 +33,9 @@ void setup() { Radio.Init( &RadioEvents ); Radio.Sleep(); memcpy(ChanSet.name, MESHTASTIC_NAME, 12); - ChanSet.channel_num = hash( MESHTASTIC_NAME ) % myRegion[REGION].numChannels; // see config.h - ChanSet.tx_power = (myRegion[REGION].powerLimit == 0) ? TX_MAX_POWER : myRegion[REGION].powerLimit; + REGION -= 1; + ChanSet.channel_num = hash( MESHTASTIC_NAME ) % regions[REGION].numChannels; // see config.h + ChanSet.tx_power = (regions[REGION].powerLimit == 0) ? TX_MAX_POWER : regions[REGION].powerLimit ; if (ChanSet.tx_power > TX_MAX_POWER) ChanSet.tx_power = TX_MAX_POWER; ChanSet.psk = MESHTASTIC_PSK; /* FYI: @@ -182,9 +183,9 @@ unsigned long hash(char *str) void ConfigureRadio( ChannelSettings ChanSet ) { - uint32_t freq = (uint32_t)(myRegion[REGION].freq + myRegion[REGION].spacing * ChanSet.channel_num)*1E6; + uint32_t freq = (regions[REGION].freq + regions[REGION].spacing * ChanSet.channel_num)*1E6; #ifndef SILENT - MSG("\nRegion is: %s\n",myRegion[REGION].code); + MSG("\nRegion is: %s\n",regions[REGION].name); MSG("Setting frequency to %i Hz (meshtastic channel %i) .. \n",freq,ChanSet.channel_num ); MSG("Channel name is: %s .. \n", ChanSet.name ); MSG("Setting bandwidth to index %i ..\n",ChanSet.bandwidth); @@ -192,9 +193,10 @@ void ConfigureRadio( ChannelSettings ChanSet ) MSG("Setting SpreadingFactor to %i ..\n",ChanSet.spread_factor); #endif Radio.SetChannel( freq ); - Radio.SetTxConfig( MODEM_LORA, ChanSet.tx_power, 0, ChanSet.bandwidth, ChanSet.spread_factor, ChanSet.coding_rate, + Radio.SetTxConfig( MODEM_LORA, ChanSet.tx_power ,0 , ChanSet.bandwidth, ChanSet.spread_factor, ChanSet.coding_rate, LORA_PREAMBLE_LENGTH, false, true, false, 0, false, 20000 ); Radio.SetRxConfig( MODEM_LORA, ChanSet.bandwidth, ChanSet.spread_factor, ChanSet.coding_rate, 0, LORA_PREAMBLE_LENGTH, LORA_SYMBOL_TIMEOUT, false , 0, true, false, 0, false, true ); } +