Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile error when USE_HW_FLOW_CTRL defined #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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