Skip to content

Commit

Permalink
Merge branch 'master' into teamrace-basic
Browse files Browse the repository at this point in the history
  • Loading branch information
CapnBry committed Mar 11, 2024
2 parents 6b73ff5 + 7ff2bdb commit 7a0b807
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ typedef enum
MODE_STATES,
// States below here are special mode states
noCrossfire,
bleJoystick,
NO_CONFIG_SAVE_STATES,
wifiUpdate,
serialUpdate,
bleJoystick,
// Failure states go below here to display immediately
FAILURE_STATES,
radioFailed,
Expand Down
7 changes: 5 additions & 2 deletions src/lib/ServoOutput/devServoOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

static int8_t servoPins[PWM_MAX_CHANNELS];
static pwm_channel_t pwmChannels[PWM_MAX_CHANNELS];
static uint16_t pwmChannelValues[PWM_MAX_CHANNELS];

#if (defined(PLATFORM_ESP32))
static DShotRMT *dshotInstances[PWM_MAX_CHANNELS] = {nullptr};
Expand Down Expand Up @@ -62,8 +63,9 @@ static void servoWrite(uint8_t ch, uint16_t us)
}
else
#endif
if (servoPins[ch] != UNDEF_PIN)
if (servoPins[ch] != UNDEF_PIN && pwmChannelValues[ch] != us)
{
pwmChannelValues[ch] = us;
if ((eServoOutputMode)chConfig->val.mode == somOnOff)
{
digitalWrite(servoPins[ch], us > 1500);
Expand Down Expand Up @@ -152,6 +154,7 @@ static void initialize()
#endif
for (int ch = 0; ch < GPIO_PIN_PWM_OUTPUTS_COUNT; ++ch)
{
pwmChannelValues[ch] = UINT16_MAX;
pwmChannels[ch] = -1;
int8_t pin = GPIO_PIN_PWM_OUTPUTS[ch];
#if (defined(DEBUG_LOG) || defined(DEBUG_RCVR_LINKSTATS)) && (defined(PLATFORM_ESP8266) || defined(PLATFORM_ESP32))
Expand All @@ -166,7 +169,7 @@ static void initialize()
}
#endif
// Mark servo pins that are being used for serial (or other purposes) as disconnected
eServoOutputMode mode = (eServoOutputMode)config.GetPwmChannel(ch)->val.mode;
auto mode = (eServoOutputMode)config.GetPwmChannel(ch)->val.mode;
if (mode >= somSerial)
{
pin = UNDEF_PIN;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/VTXSPI/devVTXSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ static void initialize()
#if defined(TARGET_UNIFIED_RX)
VpdSetPointArray25mW = VPD_VALUES_25MW;
VpdSetPointArray100mW = VPD_VALUES_100MW;
PwmArray25mW = PWM_VALUES_25MW;
PwmArray100mW = PWM_VALUES_100MW;
#endif

if (GPIO_PIN_SPI_VTX_NSS != UNDEF_PIN)
Expand Down
18 changes: 11 additions & 7 deletions src/lib/WIFI/devWIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,12 +899,6 @@ static void startWiFi(unsigned long now)
WiFi.persistent(false);
WiFi.disconnect();
WiFi.mode(WIFI_OFF);
#if defined(PLATFORM_ESP8266)
WiFi.setOutputPower(13);
WiFi.setPhyMode(WIFI_PHY_MODE_11N);
#elif defined(PLATFORM_ESP32)
WiFi.setTxPower(WIFI_POWER_13dBm);
#endif
strcpy(station_ssid, firmwareOptions.home_wifi_ssid);
strcpy(station_password, firmwareOptions.home_wifi_password);
if (station_ssid[0] == 0) {
Expand Down Expand Up @@ -1116,6 +1110,12 @@ static void HandleWebUpdate()
WiFi.setHostname(wifi_hostname); // hostname must be set before the mode is set to STA
#endif
changeTime = now;
#if defined(PLATFORM_ESP8266)
WiFi.setOutputPower(20.5);
WiFi.setPhyMode(WIFI_PHY_MODE_11N);
#elif defined(PLATFORM_ESP32)
WiFi.setTxPower(WIFI_POWER_19_5dBm);
#endif
WiFi.softAPConfig(ipAddress, ipAddress, netMsk);
WiFi.softAP(wifi_ap_ssid, wifi_ap_password);
startServices();
Expand All @@ -1131,7 +1131,11 @@ static void HandleWebUpdate()
WiFi.setHostname(wifi_hostname); // hostname must be set after the mode is set to STA
#endif
changeTime = now;
#if defined(PLATFORM_ESP32)
#if defined(PLATFORM_ESP8266)
WiFi.setOutputPower(20.5);
WiFi.setPhyMode(WIFI_PHY_MODE_11N);
#elif defined(PLATFORM_ESP32)
WiFi.setTxPower(WIFI_POWER_19_5dBm);
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/src/rx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ static void updateSwitchMode()

static void CheckConfigChangePending()
{
if (config.IsModified() && !InBindingMode && connectionState != wifiUpdate)
if (config.IsModified() && !InBindingMode && connectionState < NO_CONFIG_SAVE_STATES)
{
LostConnection(false);
config.Commit();
Expand Down

0 comments on commit 7a0b807

Please sign in to comment.