Baud rate setting
This commit is contained in:
parent
32286888e5
commit
00dbdc2267
@ -211,6 +211,10 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
rlyMde = !relay["rev"];
|
||||
}
|
||||
|
||||
CJSON(serialBaud, hw[F("baud")]);
|
||||
if (serialBaud < 96 || serialBaud > 15000) serialBaud = 1152;
|
||||
updateBaudRate(serialBaud *100);
|
||||
|
||||
//int hw_status_pin = hw[F("status")]["pin"]; // -1
|
||||
|
||||
JsonObject light = doc[F("light")];
|
||||
@ -630,6 +634,8 @@ void serializeConfig() {
|
||||
hw_relay["pin"] = rlyPin;
|
||||
hw_relay["rev"] = !rlyMde;
|
||||
|
||||
hw[F("baud")] = serialBaud;
|
||||
|
||||
//JsonObject hw_status = hw.createNestedObject("status");
|
||||
//hw_status["pin"] = -1;
|
||||
|
||||
|
@ -160,7 +160,21 @@ Hue Bridge IP:<br>
|
||||
<input name="H3" type="number" class="s" min="0" max="255" ><br>
|
||||
<b>Press the pushlink button on the bridge, after that save this page!</b><br>
|
||||
(when first connecting)<br>
|
||||
Hue status: <span class="sip"> Disabled in this build </span><hr>
|
||||
Hue status: <span class="sip"> Disabled in this build </span>
|
||||
<h3>Serial</h3>
|
||||
Baud rate:
|
||||
<select name=BD>
|
||||
<option value=1152>115200</option>
|
||||
<option value=2304>230400</option>
|
||||
<option value=4608>460800</option>
|
||||
<option value=5000>500000</option>
|
||||
<option value=5760>576000</option>
|
||||
<option value=9216>921600</option>
|
||||
<option value=10000>1000000</option>
|
||||
<option value=15000>1500000</option>
|
||||
</select><br>
|
||||
<i>Keep at 115200 to use Improv. Some boards may not support high rates.</i>
|
||||
<hr>
|
||||
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
|
||||
</form>
|
||||
</body>
|
||||
|
@ -280,6 +280,7 @@ void clearEEPROM();
|
||||
|
||||
//wled_serial.cpp
|
||||
void handleSerial();
|
||||
void updateBaudRate(uint32_t rate);
|
||||
|
||||
//wled_server.cpp
|
||||
bool isIp(String str);
|
||||
|
@ -340,8 +340,14 @@ class="s" min="0" max="255"> . <input name="H2" type="number" class="s" min="0"
|
||||
max="255"> . <input name="H3" type="number" class="s" min="0" max="255"><br><b>
|
||||
Press the pushlink button on the bridge, after that save this page!</b><br>
|
||||
(when first connecting)<br>Hue status: <span class="sip">Disabled in this build
|
||||
</span><hr><button type="button" onclick="B()">Back</button><button
|
||||
type="submit">Save</button></form></body></html>)=====";
|
||||
</span><h3>Serial</h3>Baud rate: <select name="BD"><option value="1152">115200
|
||||
</option><option value="2304">230400</option><option value="4608">460800
|
||||
</option><option value="5000">500000</option><option value="5760">576000
|
||||
</option><option value="9216">921600</option><option value="10000">1000000
|
||||
</option><option value="15000">1500000</option></select><br><i>
|
||||
Keep at 115200 to use Improv. Some boards may not support high rates.</i><hr>
|
||||
<button type="button" onclick="B()">Back</button><button type="submit">Save
|
||||
</button></form></body></html>)=====";
|
||||
|
||||
|
||||
// Autogenerated from wled00/data/settings_time.htm, do not edit!!
|
||||
|
@ -309,6 +309,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
hueStoreAllowed = true;
|
||||
reconnectHue();
|
||||
#endif
|
||||
|
||||
t = request->arg(F("BD")).toInt();
|
||||
if (t >= 96 && t <= 15000) serialBaud = t;
|
||||
updateBaudRate(serialBaud *100);
|
||||
}
|
||||
|
||||
//TIME
|
||||
|
@ -370,6 +370,8 @@ WLED_GLOBAL bool hueApplyBri _INIT(true);
|
||||
WLED_GLOBAL bool hueApplyColor _INIT(true);
|
||||
#endif
|
||||
|
||||
WLED_GLOBAL uint16_t serialBaud _INIT(1152); // serial baud rate, multiply by 100
|
||||
|
||||
// Time CONFIG
|
||||
WLED_GLOBAL bool ntpEnabled _INIT(false); // get internet time. Only required if you use clock overlays or time-activated macros
|
||||
WLED_GLOBAL bool useAMPM _INIT(false); // 12h/24h clock format
|
||||
|
@ -21,9 +21,9 @@ enum class AdaState {
|
||||
|
||||
uint16_t currentBaud = 1152; //default baudrate 115200 (divided by 100)
|
||||
|
||||
void updateBaudRate(int rate){
|
||||
void updateBaudRate(uint32_t rate){
|
||||
uint16_t rate100 = rate/100;
|
||||
if (rate100 == currentBaud) return;
|
||||
if (rate100 == currentBaud || rate100 < 96) return;
|
||||
currentBaud = rate100;
|
||||
|
||||
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut){
|
||||
|
@ -551,6 +551,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
|
||||
sappends('m',SET_F("(\"sip\")[0]"),hueErrorString);
|
||||
#endif
|
||||
sappend('v',SET_F("BD"),serialBaud);
|
||||
}
|
||||
|
||||
if (subPage == 5)
|
||||
|
Loading…
Reference in New Issue
Block a user