Allow setting hostname and auto-led (#75)
Implement automatic Lamp illumination only while camera is active. (#72 thanks @TodWulff ) Allow Hostname setting (#74 thanks @mrmessy ) A couple of small fixes and some unnecessary debug output removed too.
This commit is contained in:
parent
e2dfb773d7
commit
244fbb3593
|
@ -45,8 +45,10 @@ extern int streamPort;
|
||||||
extern char httpURL[];
|
extern char httpURL[];
|
||||||
extern char streamURL[];
|
extern char streamURL[];
|
||||||
extern char default_index[];
|
extern char default_index[];
|
||||||
|
extern int8_t streamCount;
|
||||||
extern int myRotation;
|
extern int myRotation;
|
||||||
extern int lampVal;
|
extern int lampVal;
|
||||||
|
extern bool autoLamp;
|
||||||
extern int8_t detection_enabled;
|
extern int8_t detection_enabled;
|
||||||
extern int8_t recognition_enabled;
|
extern int8_t recognition_enabled;
|
||||||
extern bool filesystem;
|
extern bool filesystem;
|
||||||
|
@ -257,7 +259,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
esp_err_t res = ESP_OK;
|
esp_err_t res = ESP_OK;
|
||||||
|
|
||||||
Serial.println("Capture Requested");
|
Serial.println("Capture Requested");
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(lampVal);
|
||||||
flashLED(75); // little flash of status LED
|
flashLED(75); // little flash of status LED
|
||||||
|
|
||||||
int64_t fr_start = esp_timer_get_time();
|
int64_t fr_start = esp_timer_get_time();
|
||||||
|
@ -266,6 +268,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
Serial.println("Camera capture failed");
|
Serial.println("Camera capture failed");
|
||||||
httpd_resp_send_500(req);
|
httpd_resp_send_500(req);
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +294,10 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
}
|
}
|
||||||
esp_camera_fb_return(fb);
|
esp_camera_fb_return(fb);
|
||||||
int64_t fr_end = esp_timer_get_time();
|
int64_t fr_end = esp_timer_get_time();
|
||||||
|
if (debugData) {
|
||||||
Serial.printf("JPG: %uB %ums\n", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000));
|
Serial.printf("JPG: %uB %ums\n", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000));
|
||||||
|
}
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,6 +306,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
esp_camera_fb_return(fb);
|
esp_camera_fb_return(fb);
|
||||||
Serial.println("dl_matrix3du_alloc failed");
|
Serial.println("dl_matrix3du_alloc failed");
|
||||||
httpd_resp_send_500(req);
|
httpd_resp_send_500(req);
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +321,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
dl_matrix3du_free(image_matrix);
|
dl_matrix3du_free(image_matrix);
|
||||||
Serial.println("to rgb888 failed");
|
Serial.println("to rgb888 failed");
|
||||||
httpd_resp_send_500(req);
|
httpd_resp_send_500(req);
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,6 +344,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
dl_matrix3du_free(image_matrix);
|
dl_matrix3du_free(image_matrix);
|
||||||
if(!s){
|
if(!s){
|
||||||
Serial.println("JPEG compression failed");
|
Serial.println("JPEG compression failed");
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,6 +352,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
if (debugData) {
|
if (debugData) {
|
||||||
Serial.printf("FACE: %uB %ums %s%d\n", (uint32_t)(jchunk.len), (uint32_t)((fr_end - fr_start)/1000), detected?"DETECTED ":"", face_id);
|
Serial.printf("FACE: %uB %ums %s%d\n", (uint32_t)(jchunk.len), (uint32_t)((fr_end - fr_start)/1000), detected?"DETECTED ":"", face_id);
|
||||||
}
|
}
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,9 +371,9 @@ static esp_err_t stream_handler(httpd_req_t *req){
|
||||||
int64_t fr_encode = 0;
|
int64_t fr_encode = 0;
|
||||||
int64_t fr_ready = 0;
|
int64_t fr_ready = 0;
|
||||||
|
|
||||||
|
|
||||||
Serial.println("Stream requested");
|
Serial.println("Stream requested");
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(lampVal);
|
||||||
|
streamCount = 1; // at present we only have one stream handler..
|
||||||
flashLED(75); // double flash of status LED
|
flashLED(75); // double flash of status LED
|
||||||
delay(75);
|
delay(75);
|
||||||
flashLED(75);
|
flashLED(75);
|
||||||
|
@ -375,6 +385,7 @@ static esp_err_t stream_handler(httpd_req_t *req){
|
||||||
|
|
||||||
res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
|
res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
|
||||||
if(res != ESP_OK){
|
if(res != ESP_OK){
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,6 +508,9 @@ static esp_err_t stream_handler(httpd_req_t *req){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
|
streamCount = 0; // at present we only have one stream handler..
|
||||||
|
Serial.println("Stream ended");
|
||||||
last_frame = 0;
|
last_frame = 0;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -577,10 +591,24 @@ static esp_err_t cmd_handler(httpd_req_t *req){
|
||||||
detection_enabled = val;
|
detection_enabled = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(!strcmp(variable, "autolamp") && (lampVal != -1)) {
|
||||||
|
autoLamp = val;
|
||||||
|
if (autoLamp) {
|
||||||
|
if (streamCount > 0) setLamp(lampVal);
|
||||||
|
else setLamp(0);
|
||||||
|
} else {
|
||||||
|
setLamp(lampVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(!strcmp(variable, "lamp") && (lampVal != -1)) {
|
else if(!strcmp(variable, "lamp") && (lampVal != -1)) {
|
||||||
lampVal = constrain(val,0,100);
|
lampVal = constrain(val,0,100);
|
||||||
|
if (autoLamp) {
|
||||||
|
if (streamCount > 0) setLamp(lampVal);
|
||||||
|
else setLamp(0);
|
||||||
|
} else {
|
||||||
setLamp(lampVal);
|
setLamp(lampVal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(!strcmp(variable, "save_face")) {
|
else if(!strcmp(variable, "save_face")) {
|
||||||
if (filesystem) saveFaceDB(SPIFFS);
|
if (filesystem) saveFaceDB(SPIFFS);
|
||||||
}
|
}
|
||||||
|
@ -619,6 +647,7 @@ static esp_err_t status_handler(httpd_req_t *req){
|
||||||
char * p = json_response;
|
char * p = json_response;
|
||||||
*p++ = '{';
|
*p++ = '{';
|
||||||
p+=sprintf(p, "\"lamp\":%d,", lampVal);
|
p+=sprintf(p, "\"lamp\":%d,", lampVal);
|
||||||
|
p+=sprintf(p, "\"autolamp\":%d,", autoLamp);
|
||||||
p+=sprintf(p, "\"framesize\":%u,", s->status.framesize);
|
p+=sprintf(p, "\"framesize\":%u,", s->status.framesize);
|
||||||
p+=sprintf(p, "\"quality\":%u,", s->status.quality);
|
p+=sprintf(p, "\"quality\":%u,", s->status.quality);
|
||||||
p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);
|
p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);
|
||||||
|
@ -987,10 +1016,6 @@ void startCameraServer(int hPort, int sPort){
|
||||||
// Face ID list (settings + pointer to the data allocation)
|
// Face ID list (settings + pointer to the data allocation)
|
||||||
face_id_init(&id_list, FACE_ID_SAVE_NUMBER, ENROLL_CONFIRM_TIMES);
|
face_id_init(&id_list, FACE_ID_SAVE_NUMBER, ENROLL_CONFIRM_TIMES);
|
||||||
// The size of the allocated data block; calculated in dl_lib_calloc()
|
// The size of the allocated data block; calculated in dl_lib_calloc()
|
||||||
id_list_alloc = FACE_ID_SAVE_NUMBER * sizeof(dl_matrix3d_t *) + sizeof(void *);
|
|
||||||
Serial.print("FACE DB SIZE: ");
|
|
||||||
Serial.println(id_list_alloc);
|
|
||||||
Serial.printf("FACE DB POINTER: %p\n", id_list.id_list);
|
|
||||||
|
|
||||||
config.server_port = hPort;
|
config.server_port = hPort;
|
||||||
config.ctrl_port = hPort;
|
config.ctrl_port = hPort;
|
||||||
|
|
|
@ -107,7 +107,6 @@ int stationCount = sizeof(stationList)/sizeof(stationList[0]);
|
||||||
char default_index[] = "simple";
|
char default_index[] = "simple";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// DNS server
|
// DNS server
|
||||||
const byte DNS_PORT = 53;
|
const byte DNS_PORT = 53;
|
||||||
DNSServer dnsServer;
|
DNSServer dnsServer;
|
||||||
|
@ -118,6 +117,9 @@ char apName[64] = "Undefined";
|
||||||
char httpURL[64] = {"Undefined"};
|
char httpURL[64] = {"Undefined"};
|
||||||
char streamURL[64] = {"Undefined"};
|
char streamURL[64] = {"Undefined"};
|
||||||
|
|
||||||
|
// Count number of active streams
|
||||||
|
int8_t streamCount = 0;
|
||||||
|
|
||||||
// This will be displayed to identify the firmware
|
// This will be displayed to identify the firmware
|
||||||
char myVer[] PROGMEM = __DATE__ " @ " __TIME__;
|
char myVer[] PROGMEM = __DATE__ " @ " __TIME__;
|
||||||
|
|
||||||
|
@ -140,6 +142,7 @@ int myRotation = CAM_ROTATION;
|
||||||
#else
|
#else
|
||||||
int lampVal = -1; // no lamp pin assigned
|
int lampVal = -1; // no lamp pin assigned
|
||||||
#endif
|
#endif
|
||||||
|
bool autoLamp = false; // Automatic lamp (auto on while camera running)
|
||||||
|
|
||||||
int lampChannel = 7; // a free PWM channel (some channels used by camera)
|
int lampChannel = 7; // a free PWM channel (some channels used by camera)
|
||||||
const int pwmfreq = 50000; // 50K pwm frequency
|
const int pwmfreq = 50000; // 50K pwm frequency
|
||||||
|
@ -281,6 +284,11 @@ void WifiSetup() {
|
||||||
Serial.println("Static IP settings requested but not defined in config, falling back to dhcp");
|
Serial.println("Static IP settings requested but not defined in config, falling back to dhcp");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HOSTNAME)
|
||||||
|
WiFi.setHostname(HOSTNAME);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initiate network connection request
|
// Initiate network connection request
|
||||||
WiFi.begin(stationList[bestStation].ssid, stationList[bestStation].password);
|
WiFi.begin(stationList[bestStation].ssid, stationList[bestStation].password);
|
||||||
|
|
||||||
|
@ -522,7 +530,8 @@ void setup() {
|
||||||
// Initialise and set the lamp
|
// Initialise and set the lamp
|
||||||
if (lampVal != -1) {
|
if (lampVal != -1) {
|
||||||
ledcSetup(lampChannel, pwmfreq, pwmresolution); // configure LED PWM channel
|
ledcSetup(lampChannel, pwmfreq, pwmresolution); // configure LED PWM channel
|
||||||
setLamp(lampVal); // set default value
|
if (autoLamp) setLamp(0); // set default value
|
||||||
|
else setLamp(lampVal);
|
||||||
ledcAttachPin(LAMP_PIN, lampChannel); // attach the GPIO pin to the channel
|
ledcAttachPin(LAMP_PIN, lampChannel); // attach the GPIO pin to the channel
|
||||||
} else {
|
} else {
|
||||||
Serial.println("No lamp, or lamp disabled in config");
|
Serial.println("No lamp, or lamp disabled in config");
|
||||||
|
@ -537,15 +546,22 @@ void setup() {
|
||||||
// Now we have a network we can start the two http handlers for the UI and Stream.
|
// Now we have a network we can start the two http handlers for the UI and Stream.
|
||||||
startCameraServer(httpPort, streamPort);
|
startCameraServer(httpPort, streamPort);
|
||||||
|
|
||||||
// Construct the app and stream URLs
|
#if defined(URL_HOSTNAME)
|
||||||
|
if (httpPort != 80) {
|
||||||
|
sprintf(httpURL, "http://%s:%d/", URL_HOSTNAME, httpPort);
|
||||||
|
} else {
|
||||||
|
sprintf(httpURL, "http://%s/", URL_HOSTNAME);
|
||||||
|
}
|
||||||
|
sprintf(streamURL, "http://%s:%d/", URL_HOSTNAME, streamPort);
|
||||||
|
#else
|
||||||
if (httpPort != 80) {
|
if (httpPort != 80) {
|
||||||
sprintf(httpURL, "http://%d.%d.%d.%d:%d/", ip[0], ip[1], ip[2], ip[3], httpPort);
|
sprintf(httpURL, "http://%d.%d.%d.%d:%d/", ip[0], ip[1], ip[2], ip[3], httpPort);
|
||||||
} else {
|
} else {
|
||||||
sprintf(httpURL, "http://%d.%d.%d.%d/", ip[0], ip[1], ip[2], ip[3]);
|
sprintf(httpURL, "http://%d.%d.%d.%d/", ip[0], ip[1], ip[2], ip[3]);
|
||||||
}
|
}
|
||||||
Serial.printf("\nCamera Ready!\nUse '%s' to connect\n", httpURL);
|
|
||||||
// Construct the Stream URL
|
|
||||||
sprintf(streamURL, "http://%d.%d.%d.%d:%d/", ip[0], ip[1], ip[2], ip[3], streamPort);
|
sprintf(streamURL, "http://%d.%d.%d.%d:%d/", ip[0], ip[1], ip[2], ip[3], streamPort);
|
||||||
|
#endif
|
||||||
|
Serial.printf("\nCamera Ready!\nUse '%s' to connect\n", httpURL);
|
||||||
Serial.printf("Stream viewer available at '%sview'\n", streamURL);
|
Serial.printf("Stream viewer available at '%sview'\n", streamURL);
|
||||||
Serial.printf("Raw stream URL is '%s'\n", streamURL);
|
Serial.printf("Raw stream URL is '%s'\n", streamURL);
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ const uint8_t index_simple_html[] = R"=====(<!doctype html>
|
||||||
applyRotation();
|
applyRotation();
|
||||||
} else if(el.id === "stream_url"){
|
} else if(el.id === "stream_url"){
|
||||||
streamURL = value;
|
streamURL = value;
|
||||||
streamButton.setAttribute("title", `Start the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Start the stream :: {streamURL}`);
|
||||||
console.log('Stream URL set to:' + value);
|
console.log('Stream URL set to:' + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,12 +190,12 @@ const uint8_t index_simple_html[] = R"=====(<!doctype html>
|
||||||
})
|
})
|
||||||
|
|
||||||
// Put some helpful text on the 'Still' button
|
// Put some helpful text on the 'Still' button
|
||||||
stillButton.setAttribute("title", `Capture a still image (${baseHost}/capture)`);
|
stillButton.setAttribute("title", `Capture a still image :: ${baseHost}/capture`);
|
||||||
|
|
||||||
const stopStream = () => {
|
const stopStream = () => {
|
||||||
window.stop();
|
window.stop();
|
||||||
streamButton.innerHTML = 'Start Stream';
|
streamButton.innerHTML = 'Start Stream';
|
||||||
streamButton.setAttribute("title", `Start the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Start the stream :: ${streamURL}`);
|
||||||
hide(viewContainer);
|
hide(viewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ const uint8_t index_simple_html[] = R"=====(<!doctype html>
|
||||||
view.src = streamURL;
|
view.src = streamURL;
|
||||||
view.scrollIntoView(false);
|
view.scrollIntoView(false);
|
||||||
streamButton.innerHTML = 'Stop Stream';
|
streamButton.innerHTML = 'Stop Stream';
|
||||||
streamButton.setAttribute("title", `Stop the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Stop the stream`);
|
||||||
show(viewContainer);
|
show(viewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,14 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
|
||||||
<input type="range" id="lamp" min="0" max="100" value="0" class="default-action">
|
<input type="range" id="lamp" min="0" max="100" value="0" class="default-action">
|
||||||
<div class="range-max">Full</div>
|
<div class="range-max">Full</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group hidden" id="autolamp-group">
|
||||||
|
<label for="autolamp">Auto Lamp</label>
|
||||||
|
<div class="switch">
|
||||||
|
<input id="autolamp" type="checkbox" class="default-action" title="Lamp only on when camera active">
|
||||||
|
<label class="slider" for="autolamp"></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="input-group" id="framesize-group">
|
<div class="input-group" id="framesize-group">
|
||||||
<label for="framesize">Resolution</label>
|
<label for="framesize">Resolution</label>
|
||||||
<select id="framesize" class="default-action">
|
<select id="framesize" class="default-action">
|
||||||
|
@ -288,6 +296,7 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
|
||||||
const settings = document.getElementById('sidebar')
|
const settings = document.getElementById('sidebar')
|
||||||
const waitSettings = document.getElementById('wait-settings')
|
const waitSettings = document.getElementById('wait-settings')
|
||||||
const lampGroup = document.getElementById('lamp-group')
|
const lampGroup = document.getElementById('lamp-group')
|
||||||
|
const autolampGroup = document.getElementById('autolamp-group')
|
||||||
const streamGroup = document.getElementById('stream-group')
|
const streamGroup = document.getElementById('stream-group')
|
||||||
const camName = document.getElementById('cam_name')
|
const camName = document.getElementById('cam_name')
|
||||||
const codeVer = document.getElementById('code_ver')
|
const codeVer = document.getElementById('code_ver')
|
||||||
|
@ -358,8 +367,10 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
|
||||||
} else if(el.id === "lamp"){
|
} else if(el.id === "lamp"){
|
||||||
if (value == -1) {
|
if (value == -1) {
|
||||||
hide(lampGroup)
|
hide(lampGroup)
|
||||||
|
hide(autolampGroup)
|
||||||
} else {
|
} else {
|
||||||
show(lampGroup)
|
show(lampGroup)
|
||||||
|
show(autolampGroup)
|
||||||
}
|
}
|
||||||
} else if(el.id === "cam_name"){
|
} else if(el.id === "cam_name"){
|
||||||
camName.innerHTML = value;
|
camName.innerHTML = value;
|
||||||
|
@ -375,10 +386,10 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
|
||||||
streamURL = value;
|
streamURL = value;
|
||||||
viewerURL = value + 'view';
|
viewerURL = value + 'view';
|
||||||
stream_url.innerHTML = value;
|
stream_url.innerHTML = value;
|
||||||
stream_link.setAttribute("title", "Open stream viewer (" + viewerURL + ")");
|
stream_link.setAttribute("title", `Open the standalone stream viewer :: ${viewerURL}`);
|
||||||
stream_link.style.textDecoration = "underline";
|
stream_link.style.textDecoration = "underline";
|
||||||
stream_link.style.cursor = "pointer";
|
stream_link.style.cursor = "pointer";
|
||||||
streamButton.setAttribute("title", `Start the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Start the stream :: ${streamURL}`);
|
||||||
show(streamGroup)
|
show(streamGroup)
|
||||||
console.log('Stream URL set to: ' + streamURL);
|
console.log('Stream URL set to: ' + streamURL);
|
||||||
console.log('Stream Viewer URL set to: ' + viewerURL);
|
console.log('Stream Viewer URL set to: ' + viewerURL);
|
||||||
|
@ -438,12 +449,12 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
|
||||||
})
|
})
|
||||||
|
|
||||||
// Put some helpful text on the 'Still' button
|
// Put some helpful text on the 'Still' button
|
||||||
stillButton.setAttribute("title", `Capture a still image (${baseHost}/capture)`);
|
stillButton.setAttribute("title", `Capture a still image :: ${baseHost}/capture`);
|
||||||
|
|
||||||
const stopStream = () => {
|
const stopStream = () => {
|
||||||
window.stop();
|
window.stop();
|
||||||
streamButton.innerHTML = 'Start Stream';
|
streamButton.innerHTML = 'Start Stream';
|
||||||
streamButton.setAttribute("title", `Start the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Start the stream :: ${streamURL}`);
|
||||||
hide(viewContainer);
|
hide(viewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +462,7 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
|
||||||
view.src = streamURL;
|
view.src = streamURL;
|
||||||
view.scrollIntoView(false);
|
view.scrollIntoView(false);
|
||||||
streamButton.innerHTML = 'Stop Stream';
|
streamButton.innerHTML = 'Stop Stream';
|
||||||
streamButton.setAttribute("title", `Stop the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Stop the stream`);
|
||||||
show(viewContainer);
|
show(viewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,14 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
|
||||||
<input type="range" id="lamp" min="0" max="100" value="0" class="default-action">
|
<input type="range" id="lamp" min="0" max="100" value="0" class="default-action">
|
||||||
<div class="range-max">Full</div>
|
<div class="range-max">Full</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group hidden" id="autolamp-group">
|
||||||
|
<label for="autolamp">Auto Lamp</label>
|
||||||
|
<div class="switch">
|
||||||
|
<input id="autolamp" type="checkbox" class="default-action" title="Lamp only on when camera active">
|
||||||
|
<label class="slider" for="autolamp"></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="input-group" id="framesize-group">
|
<div class="input-group" id="framesize-group">
|
||||||
<label for="framesize">Resolution</label>
|
<label for="framesize">Resolution</label>
|
||||||
<select id="framesize" class="default-action">
|
<select id="framesize" class="default-action">
|
||||||
|
@ -301,6 +309,7 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
|
||||||
const settings = document.getElementById('sidebar')
|
const settings = document.getElementById('sidebar')
|
||||||
const waitSettings = document.getElementById('wait-settings')
|
const waitSettings = document.getElementById('wait-settings')
|
||||||
const lampGroup = document.getElementById('lamp-group')
|
const lampGroup = document.getElementById('lamp-group')
|
||||||
|
const autolampGroup = document.getElementById('autolamp-group')
|
||||||
const streamGroup = document.getElementById('stream-group')
|
const streamGroup = document.getElementById('stream-group')
|
||||||
const camName = document.getElementById('cam_name')
|
const camName = document.getElementById('cam_name')
|
||||||
const codeVer = document.getElementById('code_ver')
|
const codeVer = document.getElementById('code_ver')
|
||||||
|
@ -369,8 +378,10 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
|
||||||
} else if(el.id === "lamp"){
|
} else if(el.id === "lamp"){
|
||||||
if (value == -1) {
|
if (value == -1) {
|
||||||
hide(lampGroup)
|
hide(lampGroup)
|
||||||
|
hide(autolampGroup)
|
||||||
} else {
|
} else {
|
||||||
show(lampGroup)
|
show(lampGroup)
|
||||||
|
show(autolampGroup)
|
||||||
}
|
}
|
||||||
} else if(el.id === "cam_name"){
|
} else if(el.id === "cam_name"){
|
||||||
camName.innerHTML = value;
|
camName.innerHTML = value;
|
||||||
|
@ -386,10 +397,10 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
|
||||||
streamURL = value;
|
streamURL = value;
|
||||||
viewerURL = value + 'view';
|
viewerURL = value + 'view';
|
||||||
stream_url.innerHTML = value;
|
stream_url.innerHTML = value;
|
||||||
stream_link.setAttribute("title", "Open stream viewer (" + viewerURL + ")");
|
stream_link.setAttribute("title", `Open the standalone stream viewer :: ${viewerURL}`);
|
||||||
stream_link.style.textDecoration = "underline";
|
stream_link.style.textDecoration = "underline";
|
||||||
stream_link.style.cursor = "pointer";
|
stream_link.style.cursor = "pointer";
|
||||||
streamButton.setAttribute("title", `Start the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Start the stream :: ${streamURL}`);
|
||||||
show(streamGroup)
|
show(streamGroup)
|
||||||
console.log('Stream URL set to: ' + streamURL);
|
console.log('Stream URL set to: ' + streamURL);
|
||||||
console.log('Stream Viewer URL set to: ' + viewerURL);
|
console.log('Stream Viewer URL set to: ' + viewerURL);
|
||||||
|
@ -449,12 +460,12 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
|
||||||
})
|
})
|
||||||
|
|
||||||
// Put some helpful text on the 'Still' button
|
// Put some helpful text on the 'Still' button
|
||||||
stillButton.setAttribute("title", `Capture a still image (${baseHost}/capture)`);
|
stillButton.setAttribute("title", `Capture a still image :: ${baseHost}/capture`);
|
||||||
|
|
||||||
const stopStream = () => {
|
const stopStream = () => {
|
||||||
window.stop();
|
window.stop();
|
||||||
streamButton.innerHTML = 'Start Stream';
|
streamButton.innerHTML = 'Start Stream';
|
||||||
streamButton.setAttribute("title", `Start the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Start the stream :: ${streamURL}`);
|
||||||
hide(viewContainer);
|
hide(viewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +473,7 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
|
||||||
view.src = streamURL;
|
view.src = streamURL;
|
||||||
view.scrollIntoView(false);
|
view.scrollIntoView(false);
|
||||||
streamButton.innerHTML = 'Stop Stream';
|
streamButton.innerHTML = 'Stop Stream';
|
||||||
streamButton.setAttribute("title", `Stop the stream (${streamURL})`);
|
streamButton.setAttribute("title", `Stop the stream`);
|
||||||
show(viewContainer);
|
show(viewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
/* Version of upstream code */
|
/* Version of upstream code */
|
||||||
|
|
||||||
char baseVersion[] = "3.0-RC1";
|
char baseVersion[] = "3.0-RC2";
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
extern void flashLED(int flashtime);
|
extern void flashLED(int flashtime);
|
||||||
extern int myRotation; // Rotation
|
extern int myRotation; // Rotation
|
||||||
extern int lampVal; // The current Lamp value
|
extern int lampVal; // The current Lamp value
|
||||||
|
extern int autoLamp; // Automatic lamp mode
|
||||||
extern int8_t detection_enabled; // Face detection enable
|
extern int8_t detection_enabled; // Face detection enable
|
||||||
extern int8_t recognition_enabled; // Face recognition enable
|
extern int8_t recognition_enabled; // Face recognition enable
|
||||||
|
|
||||||
|
@ -76,6 +77,7 @@ void loadPrefs(fs::FS &fs){
|
||||||
sensor_t * s = esp_camera_sensor_get();
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
// process all the settings
|
// process all the settings
|
||||||
lampVal = jsonExtract(prefs, "lamp").toInt();
|
lampVal = jsonExtract(prefs, "lamp").toInt();
|
||||||
|
autoLamp = jsonExtract(prefs, "autolamp").toInt();
|
||||||
s->set_framesize(s, (framesize_t)jsonExtract(prefs, "framesize").toInt());
|
s->set_framesize(s, (framesize_t)jsonExtract(prefs, "framesize").toInt());
|
||||||
s->set_quality(s, jsonExtract(prefs, "quality").toInt());
|
s->set_quality(s, jsonExtract(prefs, "quality").toInt());
|
||||||
s->set_brightness(s, jsonExtract(prefs, "brightness").toInt());
|
s->set_brightness(s, jsonExtract(prefs, "brightness").toInt());
|
||||||
|
@ -123,6 +125,7 @@ void savePrefs(fs::FS &fs){
|
||||||
char * p = json_response;
|
char * p = json_response;
|
||||||
*p++ = '{';
|
*p++ = '{';
|
||||||
p+=sprintf(p, "\"lamp\":%i,", lampVal);
|
p+=sprintf(p, "\"lamp\":%i,", lampVal);
|
||||||
|
p+=sprintf(p, "\"autolamp\":%u,", autoLamp);
|
||||||
p+=sprintf(p, "\"framesize\":%u,", s->status.framesize);
|
p+=sprintf(p, "\"framesize\":%u,", s->status.framesize);
|
||||||
p+=sprintf(p, "\"quality\":%u,", s->status.quality);
|
p+=sprintf(p, "\"quality\":%u,", s->status.quality);
|
||||||
p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);
|
p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);
|
||||||
|
|
Loading…
Reference in New Issue