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

Not an issue, but a suggested feature with code #6

Open
RickSeiden opened this issue Nov 6, 2020 · 2 comments
Open

Not an issue, but a suggested feature with code #6

RickSeiden opened this issue Nov 6, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@RickSeiden
Copy link

Hi,

Thanks for your help on the last issue. I've added some code to v1.4 to include a brightness setting. I thought I'd share it with you. I've attached my versions of main.cpp, and request_handler.h, and here are the changes I made using the line numbers in my files. Feel free to add this to your project, or toss it in the bin. It's just something I added, and thought I'd give back.

Rick
main.cpp.txt
request_handler.h.txt

  • main.cpp
  • 134 char paramBrightnessValue[INTEGER_LEN];
  • 140 IotWebConfParameter paramBrightness = IotWebConfParameter("Brightness (default: 10)", "brightness", paramBrightnessValue, INTEGER_LEN, "number", "1..100", "16", "min='1' max='100' step='1'");
  • 149 int brightness;
  • 612 iotWebConf.addParameter(&paramBrightness);
  • 628 brightness = atoi(paramBrightnessValue);
  • 629 if (brightness == 0) {
  • 630 DBG_PRINTLN(F("Brightness=0, using 10."));
  • 631 brightness = 10;
  • 632 }
  • 633 ws2812fx.setBrightness(brightness);
  • request_handler.h
  • 169 s += "<div class="nes-field mt-s"><label for="name_field">Brightness<input type="text" id="name_field" class="nes-input" disabled value="" + String(paramBrightnessValue) + "">";
  •   207  responseDoc["brightness"].set(paramBrightnessValue);
    
  • 270 int l5 = server.arg(paramBrightness.getId()).length();
  • 271 if (l5 < 1)
  • 272 {
  • 273 paramBrightness.errorMessage = "Please provide a value for the brightness!";
  • 274 valid=false;
  • 275 }
  • 283 ws2812fx.setBrightness(atoi(paramBrightnessValue));
@toblum
Copy link
Owner

toblum commented Nov 8, 2020

Thank you @rasppliances. I'll keep that open and have a look at it when I work again at it.

@toblum toblum self-assigned this Nov 8, 2020
@toblum toblum added the enhancement New feature or request label Nov 8, 2020
@toblum
Copy link
Owner

toblum commented Jan 17, 2021

See: #10 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants