I have an arduino board with a WIFI shield. I am assembling and testing my units at home and deploying them at a test-site.
These are the sets of parameters that I am using now:
Home:
String WIFI_SSID = "myssid";
String WIFI_PASSWORD = "123";
bool USE_IP = true;
int PORT = 8080;
String IP = "192.168.1.140";
String DOMAIN = null;
Test-site:
String WIFI_SSID = "Test-siteSSID";
String WIFI_PASSWORD = "456";
bool USE_IP = false;
int PORT = 80;
String IP = null;
String DOMAIN = "www.google.com";
I find it very annoying that I have to change these variables manually in the Arduino IDE whenever I am switching locations (which happens quite frequently). So I took a look at https://github.com/sudar/Arduino-Makefile which could allow me to use command line to build and compile arduino code.
This is what I plan to do:
make HOME
or make DEPLOY
My questions are:
HOME
or DEPLOY
in step 2? This goes in your makefile:
TARGET?=DEPLOY
all: build ...
build:
\tgcc ... -D$(TARGET) ...
.PHONY: all build ...
This goes in your source code:
#ifdef DEPLOY
#include "defs_deploy.h"
#else
#ifdef HOME
#include "defs_home.h"
#else
#error Neither DEPLOY nor HOME is defined
#endif /* HOME */
#endif /* DEPLOY */
One of these goes on your command line:
make TARGET=DEPLOY
make TARGET=HOME
Not pretty, but it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.