Net Debug / Net Serial updates

Add PinManagerClass::manageDebugTXPin to handle allocating pins for WLED_DEBUG_HOST and WLED_DEBUG
This commit is contained in:
Ewoud
2023-03-23 14:21:42 +01:00
parent d424c738cd
commit 27c4d98ada
9 changed files with 1346 additions and 1327 deletions

View File

@@ -670,7 +670,7 @@ function populateInfo(i)
cn += `v${i.ver} &nbsp;<i>"${vcn}"</i><p>(WLEDMM_${i.ver} ${i.rel}.bin)</p><p><em>build ${i.vid}</em></p><table>
${urows}
${urows===""?'':'<tr><td colspan=2><hr style="height:1px;border-width:0;color:SeaGreen;background-color:Seagreen"></td></tr>'}
${i.opt&0x100?inforow("Net Debug ☾","<button class=\"btn btn-xs\" onclick=\"requestJson({'netDebug':"+(i.opt&0x0080?"false":"true")+"});\"><i class=\"icons "+(i.opt&0x0080?"on":"off")+"\">&#xe08f;</i></button>"):''}
${i.opt&0x100?inforow("Net Serial ☾","<button class=\"btn btn-xs\" onclick=\"requestJson({'netDebug':"+(i.opt&0x0080?"false":"true")+"});\"><i class=\"icons "+(i.opt&0x0080?"on":"off")+"\">&#xe08f;</i></button>"):''}
${inforow("Build",i.vid)}
${inforow("Estimated current",pwru)}
${inforow("Average FPS",i.leds.fps)}

View File

@@ -246,9 +246,9 @@ Hue status: <span class="sip"> Disabled in this build </span>
<option value=15000>1500000</option>
</select><br>
<i>Keep at 115200 to use Improv. Some boards may not support high rates.</i>
<h3>Net Debug</h3>
<h3>Net Serial</h3>
<div id="NoNetDebug" class="hide">
<em style="color:#fa0;">This firmware build does not include Net Debug support.<br></em>
<em style="color:#fa0;">This firmware build does not include Net Serial support.<br></em> <!--WLEDMM we call it Net Serial-->
</div>
<div id="NetDebug"> <!--WLEDMM-->
Netcat host IP:<br>

View File

@@ -1087,7 +1087,7 @@ const uint8_t PAGE_settings_ui[] PROGMEM = {
// Autogenerated from wled00/data/settings_sync.htm, do not edit!!
const uint16_t PAGE_settings_sync_length = 3651;
const uint16_t PAGE_settings_sync_length = 3650;
const uint8_t PAGE_settings_sync[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x5a, 0xeb, 0x72, 0xdb, 0x36,
0x16, 0xfe, 0xcf, 0xa7, 0x40, 0xd8, 0x99, 0x56, 0xaa, 0x65, 0xdd, 0x6c, 0x39, 0x8e, 0x2d, 0x32,
@@ -1305,19 +1305,19 @@ const uint8_t PAGE_settings_sync[] PROGMEM = {
0xd5, 0x28, 0x4a, 0xb5, 0xd0, 0x56, 0x43, 0x09, 0xf8, 0x27, 0x63, 0x11, 0xe2, 0x59, 0xad, 0x2b,
0x2c, 0x91, 0x88, 0x73, 0xb4, 0xa5, 0xaa, 0x64, 0xc8, 0xa1, 0x8f, 0x1c, 0x71, 0x1a, 0xbb, 0x1a,
0x5a, 0xa3, 0x81, 0x52, 0x73, 0x93, 0x29, 0x98, 0x59, 0xd9, 0x23, 0x3b, 0x3f, 0xde, 0x43, 0xa4,
0x24, 0x49, 0x97, 0x8d, 0x92, 0x09, 0xf9, 0xef, 0xbf, 0xff, 0x53, 0x2c, 0x79, 0xf0, 0x52, 0xbd,
0xfb, 0x3b, 0xeb, 0xde, 0x6c, 0xc1, 0x8d, 0x55, 0x2f, 0x5f, 0x1e, 0xcf, 0x68, 0xa1, 0xa9, 0x52,
0xbd, 0xc3, 0xd2, 0xd4, 0x7a, 0x5d, 0x5f, 0x9d, 0x9d, 0x8c, 0xcd, 0xb9, 0xf1, 0xba, 0xf1, 0x9a,
0xe4, 0x66, 0xbc, 0x20, 0x6f, 0xbe, 0x86, 0x7c, 0x46, 0x9d, 0x1d, 0xb6, 0xbf, 0x3a, 0xb5, 0xce,
0xab, 0x43, 0x61, 0xef, 0xf4, 0xd0, 0x73, 0x5e, 0xa6, 0xfe, 0xda, 0xa3, 0xb8, 0x77, 0xf8, 0x0f,
0x64, 0x41, 0x87, 0xea, 0x8d, 0x49, 0x1d, 0x1a, 0xcd, 0x31, 0x85, 0x4e, 0x4a,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x90,
0x05, 0x5d, 0xaa, 0x37, 0x26, 0x75, 0x68, 0x35, 0xc7, 0x14, 0x7a, 0x29, 0x7d, 0xc2, 0xf7, 0xf6,
0xf0, 0xe0, 0x90, 0x3c, 0x7a, 0x80, 0x06, 0x46, 0x0c, 0xfd, 0xcb, 0xcd, 0x10, 0x02, 0x4e, 0xc7,
0x6f, 0xfb, 0x70, 0xe1, 0x5f, 0xbd, 0xe8, 0x37, 0x82, 0xdf, 0xd4, 0x41, 0x3e, 0xd6, 0x89, 0x45,
0x7f, 0xc8, 0xa2, 0xd2, 0x85, 0xfa, 0x72, 0xa5, 0x0d, 0x00, 0xd0, 0x86, 0x66, 0x70, 0xd7, 0x27,
0xbf, 0x22, 0xdf, 0xdf, 0xc8, 0x6e, 0xd2, 0xae, 0xe1, 0xa0, 0xe2, 0xa7, 0x9b, 0x39, 0xfc, 0x76,
0x62, 0xc3, 0x87, 0x1c, 0xaf, 0xf9, 0x26, 0xc3, 0x98, 0xfb, 0xde, 0x03, 0xbf, 0x3b, 0x81, 0x3f,
0xf8, 0x6d, 0x0a, 0x7e, 0xa8, 0x82, 0x5f, 0xa5, 0xfe, 0x0f, 0xaa, 0x1e, 0xd1, 0xf1, 0xa5, 0x2a,
0x00, 0x00
};

File diff suppressed because it is too large Load Diff

View File

@@ -979,7 +979,7 @@ void serializeInfo(JsonObject root)
#endif
//WLEDMM: WLED_DEBUG_HOST independent from WLED_DEBUG
#ifdef WLED_DEBUG_HOST
os = 0x80; //WLEDMM: also if not WLED_DEBUG (on off button Net Debug)
os = 0x80; //WLEDMM: also if not WLED_DEBUG (on off button Net Debug/Net Serial)
os |= 0x0100;
if (!netDebugEnabled) os &= ~0x0080;
#endif

View File

@@ -495,6 +495,20 @@ bool PinManagerClass::allocatePin(byte gpio, bool output, PinOwner tag)
return true;
}
void PinManagerClass::manageDebugTXPin()
{
#ifdef WLED_DEBUG_HOST
if (netDebugEnabled) deallocatePin(hardwareTX, PinOwner::DebugOut);
#ifdef WLED_DEBUG
else allocatePin(hardwareTX, true, PinOwner::DebugOut);
#endif
#else
#ifdef WLED_DEBUG
pinManager.allocatePin(hardwareTX, true, PinOwner::DebugOut); // TX (GPIO1 on ESP32) reserved for debug output
#endif
#endif
}
// if tag is set to PinOwner::None, checks for ANY owner of the pin.
// if tag is set to any other value, checks if that tag is the current owner of the pin.
bool PinManagerClass::isPinAllocated(byte gpio, PinOwner tag)

View File

@@ -98,6 +98,7 @@ class PinManagerClass {
// Allocates a single pin, with an owner tag.
// De-allocation requires the same owner tag (or override)
bool allocatePin(byte gpio, bool output, PinOwner tag);
void manageDebugTXPin(); //WLEDMM
// Allocates all the pins, or allocates none of the pins, with owner tag.
// Provided to simplify error condition handling in clients
// using more than one pin, such as I2C, SPI, rotary encoders,

View File

@@ -428,9 +428,8 @@ void WLED::setup()
//DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
USER_FLUSH(); // WLEDMM flush buffer now, before anything time-critial is started.
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST) // WLEDMM don't need to protect TX if we have netDebug
pinManager.allocatePin(hardwareTX, true, PinOwner::DebugOut); // TX (GPIO1 on ESP32) reserved for debug output
#endif
pinManager.manageDebugTXPin();
#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
pinManager.allocatePin(2, true, PinOwner::DMX);
#endif

View File

@@ -217,8 +217,12 @@ void appendGPIOinfo() {
oappend(SET_F(",2")); // DMX hardcoded pin
#endif
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST) // WLEDMM don't need to protect TX if we have netDebug
oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10));// debug output (TX) pin
#ifdef WLED_DEBUG
#if defined(WLED_DEBUG_HOST)
if (!netDebugEnabled) oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10));// debug output (TX) pin
#else
oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10));// debug output (TX) pin
#endif
#endif
//Note: Using pin 3 (RX) disables Adalight / Serial JSON