Skip to content

Commit

Permalink
Move AP IP to the constants file (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Roger committed Apr 15, 2016
1 parent 2c80077 commit 73d4d0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Homie/Boot/BootConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,20 @@ void BootConfig::setup() {

WiFi.mode(WIFI_AP);

IPAddress apIp(192, 168, 1, 1);
char apName[MAX_WIFI_SSID_LENGTH];
strcpy(apName, this->_interface->brand);
strcat_P(apName, PSTR("-"));
strcat(apName, Helpers::getDeviceId());

WiFi.softAPConfig(apIp, apIp, IPAddress(255, 255, 255, 0));
WiFi.softAPConfig(ACCESS_POINT_IP, ACCESS_POINT_IP, IPAddress(255, 255, 255, 0));
WiFi.softAP(apName, deviceId);

Logger.log(F("AP started as "));
Logger.logln(apName);

this->_dns.setTTL(300);
this->_dns.setErrorReplyCode(DNSReplyCode::ServerFailure);
this->_dns.start(53, F("homie.config"), apIp);
this->_dns.start(53, F("homie.config"), ACCESS_POINT_IP);

this->_http.on("/", HTTP_GET, [this]() {
Logger.logln(F("Received index request"));
Expand Down
1 change: 1 addition & 0 deletions src/Homie/Boot/BootConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <ArduinoJson.h>
#include "Boot.hpp"
#include "../Config.hpp"
#include "../Constants.hpp"
#include "../Limits.hpp"
#include "../Datatypes/Interface.hpp"
#include "../Timer.hpp"
Expand Down
4 changes: 4 additions & 0 deletions src/Homie/Constants.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#pragma once

#include <ESP8266WiFi.h>

namespace HomieInternals {
const char VERSION[] = "1.3.0";
const unsigned long BAUD_RATE = 115200;

const IPAddress ACCESS_POINT_IP(192, 168, 1, 1);

const unsigned int DEFAULT_MQTT_PORT = 1883;
const unsigned char DEFAULT_OTA_PORT = 80;
const char DEFAULT_MQTT_BASE_TOPIC[] = "devices/";
Expand Down

0 comments on commit 73d4d0c

Please sign in to comment.