forked from github/esp8266-geigercounter
Fix custom hostname (#2)
- Changed HOSTNAME to constant macro definition so it is properly evaluated via #ifdef directive. - Increased max. hostname length to 24 characters.
This commit is contained in:
parent
4e1dbdd2b0
commit
0c10ef4ba9
2 changed files with 4 additions and 4 deletions
|
@ -30,7 +30,7 @@ char serialInputHelper[RECV_LINE_SIZE];
|
||||||
int lastCPM = 0, currentCPM = 0;
|
int lastCPM = 0, currentCPM = 0;
|
||||||
float lastuSv = 0, currentuSv = 0;
|
float lastuSv = 0, currentuSv = 0;
|
||||||
|
|
||||||
char hostname[16];
|
char hostname[24];
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
delay(3000);
|
delay(3000);
|
||||||
|
@ -55,9 +55,9 @@ void setup() {
|
||||||
|
|
||||||
|
|
||||||
#ifdef HOSTNAME
|
#ifdef HOSTNAME
|
||||||
hostname = HOSTNAME;
|
strncpy(hostname, HOSTNAME, sizeof(hostname));
|
||||||
#else
|
#else
|
||||||
snprintf(hostname, 24, "GEIGERCTR-%X", chipid);
|
snprintf(hostname, sizeof(hostname), "GEIGERCTR-%X", chipid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_HA_AUTODISCOVERY
|
#ifdef USE_HA_AUTODISCOVERY
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#define BAUD_GEIGERCOUNTER 9600
|
#define BAUD_GEIGERCOUNTER 9600
|
||||||
|
|
||||||
//const char* HOSTNAME = "ESP-GeigerCounter"; //Optional
|
//#define HOSTNAME "ESP-GeigerCounter" //Optional
|
||||||
|
|
||||||
const char* OTA_PASSWORD = "foobar";
|
const char* OTA_PASSWORD = "foobar";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue