Skip to content

Commit

Permalink
Reorganizing the HTTP server for eventual multiprocessing improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Sep 10, 2024
1 parent a0d42f5 commit 34374a1
Show file tree
Hide file tree
Showing 3 changed files with 651 additions and 650 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ _* At the moment, only text, 24-bit and 32-bit RGB overlays are handled, matrici

### Roadmap

- [ ] Audio adjustments (source, input gain, output volume)
- [ ] Audio source, input gain and output volume
- [ ] Motors and PTZ control
- [ ] ONVIF services
- [ ] Additional WebUI functionalities
- [ ] Motion detection reimplementation
- [ ] Lens correction profiles
- [ ] Local recordings with motion detection
- [ ] Alternative audio codecs


Expand Down
10 changes: 2 additions & 8 deletions src/night.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,18 @@ void *night_thread(void) {
HAL_DANGER("night", "Could not open the ADC virtual device!\n");
return NULL;
}
struct timeval tv = {
.tv_sec = app_config.check_interval_s % 12,
.tv_usec = app_config.check_interval_s / 12 * 1000000 };
while (keepRunning) {
FD_ZERO(&adc_fds);
FD_SET(adc_fd, &adc_fds);
select(adc_fd + 1, &adc_fds, NULL, NULL, &tv);
if (read(adc_fd, &val, sizeof(val)) > 0) {
usleep(10000);
tmp += val;
cnt++;
}
cnt++;
if (cnt == 12) {
tmp /= cnt;
set_night_mode(tmp >= app_config.adc_threshold);
cnt = tmp = 0;
}
usleep(250000);
usleep(app_config.check_interval_s * 1000000 / 12);
}
if (adc_fd) close(adc_fd);
} else if (app_config.ir_sensor_pin == 999) {
Expand Down
Loading

0 comments on commit 34374a1

Please sign in to comment.