From b336dd59f942020ca0f7b774a39d4a008de0f417 Mon Sep 17 00:00:00 2001
From: Dominic Moffat <dom@illysky.com>
Date: Wed, 15 May 2024 17:40:08 +0100
Subject: [PATCH] Fixes overload warning when building with ESP IDF (#1089)

* fixes overload

* fixes overload

* fixes overload warnings in ESP-IDF
---
 src/modules/LR11x0/LR11x0.cpp | 4 ++++
 src/modules/LR11x0/LR11x0.h   | 5 ++++-
 src/modules/SX126x/SX126x.cpp | 5 +++++
 src/modules/SX126x/SX126x.h   | 3 ++-
 src/modules/SX128x/SX128x.cpp | 4 ++++
 src/modules/SX128x/SX128x.h   | 3 ++-
 6 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/modules/LR11x0/LR11x0.cpp b/src/modules/LR11x0/LR11x0.cpp
index 9c4c2304..c1c4cec1 100644
--- a/src/modules/LR11x0/LR11x0.cpp
+++ b/src/modules/LR11x0/LR11x0.cpp
@@ -314,6 +314,10 @@ int16_t LR11x0::standby(uint8_t mode, bool wakeup) {
   return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_STANDBY, true, buff, 1));
 }
 
+int16_t LR11x0::sleep() {
+  return(LR11x0::sleep(true, 0));
+}
+
 int16_t LR11x0::sleep(bool retainConfig, uint32_t sleepTime) {
   // set RF switch (if present)
   this->mod->setRfSwitchState(Module::MODE_IDLE);
diff --git a/src/modules/LR11x0/LR11x0.h b/src/modules/LR11x0/LR11x0.h
index bef2e76b..25548605 100644
--- a/src/modules/LR11x0/LR11x0.h
+++ b/src/modules/LR11x0/LR11x0.h
@@ -774,7 +774,10 @@ class LR11x0: public PhysicalLayer {
       \param sleepTime Sleep duration (enables automatic wakeup), in multiples of 30.52 us. Ignored if set to 0.
       \returns \ref status_codes
     */
-    int16_t sleep(bool retainConfig = true, uint32_t sleepTime = 0);
+
+    int16_t sleep();
+
+    int16_t sleep(bool retainConfig, uint32_t sleepTime);
     
     // interrupt methods
 
diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp
index 17393a1f..cf073889 100644
--- a/src/modules/SX126x/SX126x.cpp
+++ b/src/modules/SX126x/SX126x.cpp
@@ -442,6 +442,11 @@ int16_t SX126x::scanChannel(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin)
   return(getChannelScanResult());
 }
 
+
+int16_t SX126x::sleep() {
+  return(SX126x::sleep(true));
+}
+
 int16_t SX126x::sleep(bool retainConfig) {
   // set RF switch (if present)
   this->mod->setRfSwitchState(Module::MODE_IDLE);
diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h
index 8cc3540b..3fd0a4c1 100644
--- a/src/modules/SX126x/SX126x.h
+++ b/src/modules/SX126x/SX126x.h
@@ -552,7 +552,8 @@ class SX126x: public PhysicalLayer {
       or to false to discard current configuration ("cold start"). Defaults to true.
       \returns \ref status_codes
     */
-    int16_t sleep(bool retainConfig = true);
+    int16_t sleep(); 
+    int16_t sleep(bool retainConfig);
 
     /*!
       \brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator).
diff --git a/src/modules/SX128x/SX128x.cpp b/src/modules/SX128x/SX128x.cpp
index 58ba3b29..a51ae78c 100644
--- a/src/modules/SX128x/SX128x.cpp
+++ b/src/modules/SX128x/SX128x.cpp
@@ -424,6 +424,10 @@ int16_t SX128x::scanChannel() {
   return(getChannelScanResult());
 }
 
+int16_t SX128x::sleep() {
+  return(SX128x::sleep(true));
+}
+
 int16_t SX128x::sleep(bool retainConfig) {
   // set RF switch (if present)
   this->mod->setRfSwitchState(Module::MODE_IDLE);
diff --git a/src/modules/SX128x/SX128x.h b/src/modules/SX128x/SX128x.h
index 782b95cd..69d8f975 100644
--- a/src/modules/SX128x/SX128x.h
+++ b/src/modules/SX128x/SX128x.h
@@ -463,7 +463,8 @@ class SX128x: public PhysicalLayer {
       to discard current configuration and data buffer. Defaults to true.
       \returns \ref status_codes
     */
-    int16_t sleep(bool retainConfig = true);
+    int16_t sleep();
+    int16_t sleep(bool retainConfig);
 
     /*!
       \brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator).