Skip to content

Commit

Permalink
Used defines to enable static IP configuration
Browse files Browse the repository at this point in the history
using defines is more user friendly as the user does not have to search for the commented lines
  • Loading branch information
Nikfinn99 committed Sep 18, 2018
1 parent b2885e6 commit 60fd33c
Show file tree
Hide file tree
Showing 26 changed files with 225 additions and 124 deletions.
14 changes: 9 additions & 5 deletions Lights/Arduino/EspLight-fridgefire/EspLight-fridgefire.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ uint32 io_info[PWM_CHANNELS][3] = {
// initial duty: all off
uint32 pwm_duty_init[PWM_CHANNELS] = {0, 0, 0};

// if you want to setup static ip uncomment these 3 lines and line 316
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t rgb_multiplier[] = {100, 90, 30}; // light multiplier in percentage, max = 100
uint8_t rgb[3], color_mode, scene;
Expand Down Expand Up @@ -313,7 +315,9 @@ void setup() {
pwm_init(period, pwm_duty_init, PWM_CHANNELS, io_info);
pwm_start();

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

apply_scene(EEPROM.read(2));
for (uint8_t color = 0; color < PWM_CHANNELS; color++) {
Expand Down
15 changes: 10 additions & 5 deletions Lights/Arduino/Generic_CCT_Light/Generic_CCT_Light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ uint32 io_info[PWM_CHANNELS][3] = {
uint32 pwm_duty_init[PWM_CHANNELS] = {0, 0};


// if you want to setup static ip uncomment these 3 lines and line 180
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t cct[2], scene;
bool light_state, in_transition;
Expand Down Expand Up @@ -176,8 +178,11 @@ void setup() {

pwm_init(period, pwm_duty_init, PWM_CHANNELS, io_info);
pwm_start();

#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

//WiFi.config(strip_ip, gateway_ip, subnet_mask);

apply_scene(EEPROM.read(2));
step_level[0] = cct[0] / 150.0; step_level[1] = cct[1] / 150.0;
Expand Down
16 changes: 10 additions & 6 deletions Lights/Arduino/Generic_Dimmable_Light/Generic_Dimmable_Light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ uint32 io_info[lightsCount][3] = {
uint32 pwm_duty_init[lightsCount];
//uint32 pwm_duty_init[lightsCount] = {512, 255}; this will set startup brightness to 50% on first light and 25% on second one

// if you want to setup static ip uncomment these 3 lines and line 156
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t scene;
bool light_state[lightsCount], in_transition;
Expand Down Expand Up @@ -152,8 +154,10 @@ void lightEngine() {

void setup() {
EEPROM.begin(512);

//WiFi.config(strip_ip, gateway_ip, subnet_mask);

#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

for (uint8_t ch = 0; ch < lightsCount; ch++) {
pinMode(io_info[ch][2], OUTPUT);
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/Generic_ON_OFF_device/Generic_ON_OFF_device.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
uint8_t devicesPins[devicesCount] = {12, 13, 14, 5};


// if you want to setup static ip uncomment these 3 lines and line 47
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

bool device_state[devicesCount];
byte mac[6];
Expand Down Expand Up @@ -44,7 +46,9 @@ void setup() {
pinMode(devicesPins[ch], OUTPUT);
}

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif


if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ int c;




// if you want to setup static ip uncomment these 3 lines and line 115
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

bool device_state[devicesCount];
byte mac[6];
Expand Down Expand Up @@ -112,7 +113,10 @@ void setup() {
pinMode(devicesPins[ch], OUTPUT);
}

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif



if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) {
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/Generic_RGBW_Light/Generic_RGBW_Light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
//define pins
uint8_t pins[PWM_CHANNELS] = {12, 13, 14, 5}; //red, green, blue, white

// if you want to setup static ip uncomment these 3 lines and line 72
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t colors[PWM_CHANNELS], bri, sat, color_mode, scene;
bool light_state, in_transition;
Expand Down Expand Up @@ -300,7 +302,9 @@ void setup() {
analogWrite(pins[pin], 0);
}

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

apply_scene(EEPROM.read(2));
step_level[0] = colors[0] / 150.0; step_level[1] = colors[1] / 150.0; step_level[2] = colors[2] / 150.0; step_level[3] = colors[3] / 150.0;
Expand Down
16 changes: 11 additions & 5 deletions Lights/Arduino/Generic_RGB_CCT_Light/Generic_RGB_CCT_Light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
//define pins
uint8_t pins[PWM_CHANNELS] = {13, 14, 12, 4, 5}; //red, green, blue, could white, warm white

// if you want to setup static ip uncomment these 3 lines and line 72
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);

//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif


uint8_t colors[PWM_CHANNELS], bri, sat, color_mode, scene;
bool light_state, in_transition;
Expand Down Expand Up @@ -297,7 +301,9 @@ void setup() {
analogWrite(pins[pin], 0);
}

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

apply_scene(EEPROM.read(2));
step_level[0] = colors[0] / 150.0; step_level[1] = colors[1] / 150.0; step_level[2] = colors[2] / 150.0; step_level[3] = colors[3] / 150.0; step_level[4] = colors[4] / 150.0;
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/Generic_RGB_Light/Generic_RGB_Light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
//define pins
uint8_t pins[PWM_CHANNELS] = {12, 13, 14}; //red, green, blue

// if you want to setup static ip uncomment these 3 lines and line 72
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t colors[PWM_CHANNELS], bri, sat, color_mode, scene;
bool light_state, in_transition;
Expand Down Expand Up @@ -301,7 +303,9 @@ void setup() {
analogWrite(pins[pin], 0);
}

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

apply_scene(EEPROM.read(2));
step_level[0] = colors[0] / 150.0; step_level[1] = colors[1] / 150.0; step_level[2] = colors[2] / 150.0; step_level[3] = colors[3] / 150.0;
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/MY92XX_RGBW_Light/MY92XX_RGBW_Light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ uint8_t PWM_PINS[PWM_CHANNELS] = {4, 3, 5, 6}; //RGBW order

my92xx * _my92xx;

// if you want to setup static ip uncomment these 3 lines and line 256
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t rgbw[4], color_mode, scene;
bool light_state, in_transition;
Expand Down Expand Up @@ -253,7 +255,9 @@ void setup() {
_my92xx = new my92xx(MY92XX_MODEL, MY92XX_CHIPS, MY92XX_DI_PIN, MY92XX_DCKI_PIN, MY92XX_COMMAND_DEFAULT);
_my92xx->setState(true);

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

apply_scene(EEPROM.read(2));
step_level[0] = rgbw[0] / 150.0; step_level[1] = rgbw[1] / 150.0; step_level[2] = rgbw[2] / 150.0; step_level[3] = rgbw[3] / 150.0;
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/SK6812HueStrip/SK6812HueStrip.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#define button2_pin 5 // off and bri down
#define use_hardware_switch false // on/off state and brightness can be controlled with above gpio pins. Is mandatory to connect them to ground with 10K resistors

// if you want to setup static ip uncomment these 3 lines and line 326
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

int lightLedsCount = pixelCount / lightsCount;
uint8_t rgbw[lightsCount][4], bri[lightsCount], sat[lightsCount], color_mode[lightsCount], scene;
Expand Down Expand Up @@ -400,7 +402,9 @@ void setup() {
EEPROM.begin(512);
WiFi.hostname(light_name);

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

for (uint8_t light = 0; light < lightsCount; light++) {
float transitiontime = (16 - (pixelCount / 40)) * 4;
Expand Down
16 changes: 10 additions & 6 deletions Lights/Arduino/Sonoff_S20/Sonoff_S20.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ uint8_t lastButtonState = buttonState;
unsigned long lastButtonPush = 0;
uint8_t buttonThreshold = 50;

// if you want to setup static ip uncomment these 3 lines and line 54
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

bool device_state[devicesCount];
byte mac[6];
Expand Down Expand Up @@ -51,8 +53,10 @@ void setup() {

pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
//WiFi.config(strip_ip, gateway_ip, subnet_mask);


#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) {
for (uint8_t i = 0; i < devicesCount; i++) {
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/WS2811_adjustable/WS2811_adjustable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#define button2_pin 5 // off and bri down
#define use_hardware_switch false // on/off state and brightness can be controlled with above gpio pins. Is mandatory to connect them to ground with 10K resistors
// if you want to setup static ip uncomment these 3 lines and line 326
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif
float rgb_multiplier[] = {100, 65, 30}; // light multiplier in percentage
int lightLedsCount = pixelCount / lightsCount;
Expand Down Expand Up @@ -428,7 +430,9 @@ void setup() {
EEPROM.begin(512);
WiFi.hostname(light_name);
//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif
for (uint8_t light = 0; light < lightsCount; light++) {
float transitiontime = (17 - (pixelCount / 40)) * 4;
Expand Down
14 changes: 9 additions & 5 deletions Lights/Arduino/WS2812BHueRing/WS2812BHueRing.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ uint16_t pixelStart[lightsCount + 1] = {0, 1, 21, pixelCount};
#define button1_pin 4 // on and bri up
#define button2_pin 5 // off and bri down

// if you want to setup static ip uncomment these 3 lines and line 325
//IPAddress strip_ip ( 192, 168, 10, 95);
//IPAddress gateway_ip ( 192, 168, 10, 1);
//IPAddress subnet_mask(255, 255, 255, 0);
//#define USE_STATIC_IP //! uncomment to enable Static IP Adress
#ifdef USE_STATIC_IP
IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress
IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
#endif

uint8_t rgb[lightsCount][3], bri[lightsCount], sat[lightsCount], color_mode[lightsCount], scene;
bool light_state[lightsCount], in_transition;
Expand Down Expand Up @@ -322,7 +324,9 @@ void setup() {
strip.Show();
EEPROM.begin(512);

//WiFi.config(strip_ip, gateway_ip, subnet_mask);
#ifdef USE_STATIC_IP
WiFi.config(strip_ip, gateway_ip, subnet_mask);
#endif

for (uint8_t light = 0; light < lightsCount; light++) {
float transitiontime = (17 - (pixelCount / 40)) * 4;
Expand Down
Loading

0 comments on commit 60fd33c

Please sign in to comment.