extractModeDefaults(): C strings instead of String
This commit is contained in:
parent
8719adef1e
commit
5b51ce9840
@ -665,6 +665,9 @@ void sendSysInfoUDP()
|
|||||||
#define DDP_FLAGS1_STORAGE 0x08
|
#define DDP_FLAGS1_STORAGE 0x08
|
||||||
#define DDP_FLAGS1_TIME 0x10
|
#define DDP_FLAGS1_TIME 0x10
|
||||||
|
|
||||||
|
#define DDP_TYPE_RGB24 0x0A
|
||||||
|
#define DDP_TYPE_RGBW32 0x1A // proposal, this is still not an official part of the DDP spec
|
||||||
|
|
||||||
#define DDP_ID_DISPLAY 1
|
#define DDP_ID_DISPLAY 1
|
||||||
#define DDP_ID_CONFIG 250
|
#define DDP_ID_CONFIG 250
|
||||||
#define DDP_ID_STATUS 251
|
#define DDP_ID_STATUS 251
|
||||||
@ -724,7 +727,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
|
|||||||
// write the header
|
// write the header
|
||||||
/*0*/ddpUdp.write(flags);
|
/*0*/ddpUdp.write(flags);
|
||||||
/*1*/ddpUdp.write(sequenceNumber++ & 0x0F); // sequence may be unnecessary unless we are sending twice (as requested in Sync settings)
|
/*1*/ddpUdp.write(sequenceNumber++ & 0x0F); // sequence may be unnecessary unless we are sending twice (as requested in Sync settings)
|
||||||
/*2*/ddpUdp.write(0);
|
/*2*/ddpUdp.write(0); // data type, this is not fully defined by the DDP spec and thus left at "undefined" which is assumed to be 24-bit RGB
|
||||||
/*3*/ddpUdp.write(DDP_ID_DISPLAY);
|
/*3*/ddpUdp.write(DDP_ID_DISPLAY);
|
||||||
// data offset in bytes, 32-bit number, MSB first
|
// data offset in bytes, 32-bit number, MSB first
|
||||||
/*4*/ddpUdp.write(0xFF & (channel >> 24));
|
/*4*/ddpUdp.write(0xFF & (channel >> 24));
|
||||||
|
@ -355,17 +355,20 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// extracts mode parameter defaults from last section of mode data (e.g. "Juggle@!,Trail;!,!,;!;sx=16,ix=240,1d")
|
||||||
int16_t extractModeDefaults(uint8_t mode, const char *segVar)
|
int16_t extractModeDefaults(uint8_t mode, const char *segVar)
|
||||||
{
|
{
|
||||||
if (mode < strip.getModeCount()) {
|
if (mode < strip.getModeCount()) {
|
||||||
String lineBuffer = FPSTR(strip.getModeData(mode));
|
char lineBuffer[128] = "";
|
||||||
if (lineBuffer.length() > 0) {
|
strncpy_P(lineBuffer, PSTR(strip.getModeData(mode)), 127);
|
||||||
int16_t start = lineBuffer.lastIndexOf(';');
|
if (strlen(lineBuffer) > 0) {
|
||||||
if (start<0) return -1;
|
char* startPtr = strrchr(lineBuffer, ';'); // last ";" in FX data
|
||||||
|
if (!startPtr) return -1;
|
||||||
|
|
||||||
int16_t stop = lineBuffer.indexOf(segVar, start+1);
|
char* stopPtr = strstr(startPtr, segVar);
|
||||||
if (stop<0) return -1;
|
if (!stopPtr) return -1;
|
||||||
return atoi(lineBuffer.substring(stop+strlen(segVar)+1).c_str());
|
|
||||||
|
return atoi(stopPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user