summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/apps/settings.c b/apps/settings.c
index df03bdcfcf..bad8fa29ab 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -154,6 +154,11 @@ static const char off_on_ask[] = "off,on,ask";
154static const char graphic_numeric[] = "graphic,numeric"; 154static const char graphic_numeric[] = "graphic,numeric";
155static const char off_number_spell_hover[] = "off,number,spell,hover"; 155static const char off_number_spell_hover[] = "off,number,spell,hover";
156 156
157/* keep synchronous to trig_durations and
158 trigger_times in settings_apply_trigger */
159static const char trig_durations_conf [] =
160 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min";
161
157/* the part of the settings which ends up in the RTC RAM, where available 162/* the part of the settings which ends up in the RTC RAM, where available
158 (those we either need early, save frequently, or without spinup) */ 163 (those we either need early, save frequently, or without spinup) */
159static const struct bit_entry rtc_bits[] = 164static const struct bit_entry rtc_bits[] =
@@ -350,6 +355,14 @@ static const struct bit_entry hd_bits[] =
350 355
351#ifdef HAVE_RECORDING 356#ifdef HAVE_RECORDING
352 {1, S_O(rec_startup), false, "rec screen on startup", off_on }, 357 {1, S_O(rec_startup), false, "rec screen on startup", off_on },
358
359 /* values for the trigger */
360 {8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL},
361 {8 | SIGNED, S_O(rec_stop_thres), -45, "trigger stop threshold", NULL},
362 {4, S_O(rec_start_duration), 0, "trigger start duration", trig_durations_conf},
363 {4, S_O(rec_stop_postrec), 2, "trigger stop postrec", trig_durations_conf},
364 {4, S_O(rec_stop_gap), 1, "trigger min gap", trig_durations_conf},
365 {4, S_O(rec_trigger_mode ), 1, "trigger mode", "off,no rearm,rearm"},
353#endif 366#endif
354 367
355 /* new stuff to be added at the end */ 368 /* new stuff to be added at the end */
@@ -1554,4 +1567,34 @@ unsigned int rec_timesplit_seconds(void)
1554{ 1567{
1555 return rec_timer_seconds[global_settings.rec_timesplit]; 1568 return rec_timer_seconds[global_settings.rec_timesplit];
1556} 1569}
1570
1571/*
1572 * Time strings used for the trigger durations.
1573 * Keep synchronous to trigger_times in settings_apply_trigger
1574 */
1575char *trig_durations[TRIG_DURATION_COUNT] =
1576{
1577 "0s", "1s", "2s", "5s",
1578 "10s", "15s", "20s", "25s", "30s",
1579 "1min", "2min", "5min", "10min"
1580};
1581
1582void settings_apply_trigger(void)
1583{
1584 /* Keep synchronous to trig_durations and trig_durations_conf*/
1585 static const long trigger_times[TRIG_DURATION_COUNT] = {
1586 0, HZ, 2*HZ, 5*HZ,
1587 10*HZ, 15*HZ, 20*HZ, 25*HZ, 30*HZ,
1588 60*HZ, 2*60*HZ, 5*60*HZ, 10*60*HZ
1589 };
1590
1591 peak_meter_define_trigger(
1592 global_settings.rec_start_thres,
1593 trigger_times[global_settings.rec_start_duration],
1594 MIN(trigger_times[global_settings.rec_start_duration] / 2, 2*HZ),
1595 global_settings.rec_stop_thres,
1596 trigger_times[global_settings.rec_stop_postrec],
1597 trigger_times[global_settings.rec_stop_gap]
1598 );
1599}
1557#endif 1600#endif