Skip to content

Commit 34374a1

Browse files
committed
Reorganizing the HTTP server for eventual multiprocessing improvements
1 parent a0d42f5 commit 34374a1

File tree

3 files changed

+651
-650
lines changed

3 files changed

+651
-650
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ _* At the moment, only text, 24-bit and 32-bit RGB overlays are handled, matrici
7070

7171
### Roadmap
7272

73-
- [ ] Audio adjustments (source, input gain, output volume)
73+
- [ ] Audio source, input gain and output volume
7474
- [ ] Motors and PTZ control
7575
- [ ] ONVIF services
7676
- [ ] Additional WebUI functionalities
77-
- [ ] Motion detection reimplementation
77+
- [ ] Lens correction profiles
78+
- [ ] Local recordings with motion detection
7879
- [ ] Alternative audio codecs
7980

8081

src/night.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,18 @@ void *night_thread(void) {
5050
HAL_DANGER("night", "Could not open the ADC virtual device!\n");
5151
return NULL;
5252
}
53-
struct timeval tv = {
54-
.tv_sec = app_config.check_interval_s % 12,
55-
.tv_usec = app_config.check_interval_s / 12 * 1000000 };
5653
while (keepRunning) {
57-
FD_ZERO(&adc_fds);
58-
FD_SET(adc_fd, &adc_fds);
59-
select(adc_fd + 1, &adc_fds, NULL, NULL, &tv);
6054
if (read(adc_fd, &val, sizeof(val)) > 0) {
6155
usleep(10000);
6256
tmp += val;
57+
cnt++;
6358
}
64-
cnt++;
6559
if (cnt == 12) {
6660
tmp /= cnt;
6761
set_night_mode(tmp >= app_config.adc_threshold);
6862
cnt = tmp = 0;
6963
}
70-
usleep(250000);
64+
usleep(app_config.check_interval_s * 1000000 / 12);
7165
}
7266
if (adc_fd) close(adc_fd);
7367
} else if (app_config.ir_sensor_pin == 999) {

0 commit comments

Comments
 (0)