Skip to content

Commit

Permalink
Fix compile error when USE_HW_FLOW_CTRL defined
Browse files Browse the repository at this point in the history
  • Loading branch information
nicf82 committed Dec 25, 2022
1 parent b5fafbc commit 2e70af1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions esp_modem/esp_modem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ unsigned long ctrlATime = 0; //When did we last receive a 4xCTRL-A sequence?
unsigned long ledTime = 0; // Counter for LED flashing
uint8_t txBuf[TX_BUF_SIZE]; // Transmit Buffer

#ifdef USE_HW_FLOW_CTRL
int hwFlowOff = 0;

#endif

/**
Arduino main init function
Expand All @@ -92,8 +93,8 @@ void setup()
pinMode(ESP_DCD, OUTPUT);
pinMode(ESP_DSR, OUTPUT);
pinMode(ESP_DTR, INPUT);
hwFlowOff = digitalRead(HW_FLOW_SELECT);
#ifdef USE_HW_FLOW_CTRL
hwFlowOff = digitalRead(HW_FLOW_SELECT);
if (hwFlowOff == 0) {
setHardwareFlow();
}
Expand Down Expand Up @@ -123,7 +124,7 @@ void setup()
digitalWrite(LED_PIN, HIGH);
}


#ifdef USE_HW_FLOW_CTRL
void setHardwareFlow() {
// Enable flow control of DTE -> ESP8266 data with RTS
// RTS on the EPS8266 is pin GPIO15 which is physical pin 16
Expand All @@ -139,6 +140,7 @@ void setHardwareFlow() {
pinMode(ESP_CTS, FUNCTION_4); // make pin U0CTS
SET_PERI_REG_MASK(UART_CONF0(0), UART_TX_FLOW_EN);
}
#endif

void helpMessage()
{
Expand All @@ -154,14 +156,18 @@ void helpMessage()
Serial.println("HTTP GET: ATGET<URL>");
Serial.print("MAC:");
Serial.println(WiFi.macAddress());

#ifdef USE_HW_FLOW_CTRL
Serial.print("Hardware Flow control: ");
if (hwFlowOff == 0) {
Serial.println("ON");
} else {
Serial.println("OFF");
}
Serial.println();

#else
Serial.println("Hardware Flow not compiled");
#endif
}

/**
Expand Down

0 comments on commit 2e70af1

Please sign in to comment.