mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8320 from gemu2015/webcam-update
webcam test whitout script
This commit is contained in:
commit
b83b3a0da1
|
@ -1562,6 +1562,10 @@ chknext:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
|
if (!strncmp(vname,"lip",3)) {
|
||||||
|
if (sp) strlcpy(sp,(const char*)WiFi.localIP().toString().c_str(),glob_script_mem.max_ssize);
|
||||||
|
goto strexit;
|
||||||
|
}
|
||||||
if (!strncmp(vname,"loglvl",6)) {
|
if (!strncmp(vname,"loglvl",6)) {
|
||||||
fvar=glob_script_mem.script_loglevel;
|
fvar=glob_script_mem.script_loglevel;
|
||||||
tind->index=SCRIPT_LOGLEVEL;
|
tind->index=SCRIPT_LOGLEVEL;
|
||||||
|
|
|
@ -561,6 +561,13 @@ uint8_t *out_buf=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wc_show_stream(void) {
|
||||||
|
#ifndef USE_SCRIPT
|
||||||
|
if (CamServer) WSContentSend_P("<br><img src=\"http://%s:81/stream\"><br><center>webcam stream",WiFi.localIP().toString().c_str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t wc_set_streamserver(uint32_t flag) {
|
uint32_t wc_set_streamserver(uint32_t flag) {
|
||||||
|
|
||||||
if (global_state.wifi_down) return 0;
|
if (global_state.wifi_down) return 0;
|
||||||
|
@ -583,7 +590,6 @@ uint32_t wc_set_streamserver(uint32_t flag) {
|
||||||
delete CamServer;
|
delete CamServer;
|
||||||
CamServer=NULL;
|
CamServer=NULL;
|
||||||
AddLog_P(WC_LOGLEVEL, "cam stream exit");
|
AddLog_P(WC_LOGLEVEL, "cam stream exit");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -630,6 +636,26 @@ red led = gpio 33
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
#define D_CMND_WC "webcam"
|
||||||
|
|
||||||
|
const char kWCCommands[] PROGMEM = "|" // no prefix
|
||||||
|
D_CMND_WC
|
||||||
|
;
|
||||||
|
|
||||||
|
void (* const WCCommand[])(void) PROGMEM = {
|
||||||
|
&CmndWC,
|
||||||
|
};
|
||||||
|
|
||||||
|
void CmndWC(void) {
|
||||||
|
uint8_t flag=0;
|
||||||
|
if (XdrvMailbox.data_len > 0) {
|
||||||
|
wc_set_streamserver(XdrvMailbox.payload);
|
||||||
|
wc_setup(flag);
|
||||||
|
}
|
||||||
|
if (CamServer) flag=1;
|
||||||
|
Response_P(PSTR("{\"" D_CMND_WC "\":{\"streaming\":%d}"),flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Xdrv39(uint8_t function) {
|
bool Xdrv39(uint8_t function) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -641,6 +667,12 @@ bool Xdrv39(uint8_t function) {
|
||||||
case FUNC_WEB_ADD_HANDLER:
|
case FUNC_WEB_ADD_HANDLER:
|
||||||
wc_pic_setup();
|
wc_pic_setup();
|
||||||
break;
|
break;
|
||||||
|
case FUNC_WEB_ADD_MAIN_BUTTON:
|
||||||
|
wc_show_stream();
|
||||||
|
break;
|
||||||
|
case FUNC_COMMAND:
|
||||||
|
result = DecodeCommand(kWCCommands, WCCommand);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue