summaryrefslogtreecommitdiff
path: root/instr-daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'instr-daemon.c')
-rw-r--r--instr-daemon.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/instr-daemon.c b/instr-daemon.c
index 9059208..259babb 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -215,6 +215,32 @@ static void get_root_mount ()
return;
}
+
+static void do_toggle_pulse (int chan, float pw)
+{
+ int j;
+
+ for (j=0;j<ampl_polarities;j++) {
+ Set_Pw(0,0,0,chan,pw,0);
+
+ // do each polarity
+ if (j == 0) {
+ Set_Amplitude(0,0,0,0,0,0,0,chan,smallest_allowed_number,0);
+ } else {
+ Set_Amplitude(0,0,0,0,0,0,0,chan,-smallest_allowed_number,0);
+ }
+
+ Set_Trig_Source(chan,source_hold);
+
+ // trigger IL710 twice to initialize it
+ Set_Output_State(chan,output_on);
+ Set_Trig_Source(chan,source_immediate);
+ Set_Trig_Source(chan,source_immediate);
+ Set_Output_State(chan,output_off);
+ }
+}
+
+
int main(int argc, char **argv)
{
GSocketService *service = NULL;
@@ -275,29 +301,17 @@ int main(int argc, char **argv)
for (i=0; i<max_channels; i++) {
if (globals.Flash.toggle_trig_at_boot[i]) {
- int j;
- for (j=0;j<ampl_polarities;j++) {
-
- // Set to PW to 500 ns, if possible.
- // Wide enough to use PGC in AVR-E3-W3.
- use_pw = MAX(globals.Flash.min_pw[i], 500e-9);
- use_pw = MIN(globals.Flash.max_pw[i], use_pw);
- Set_Pw(0,0,0,i,use_pw,0);
-
- // do each polarity
- if (j == 0) {
- Set_Amplitude(0,0,0,0,0,0,0,i,smallest_allowed_number,0);
- } else {
- Set_Amplitude(0,0,0,0,0,0,0,i,-smallest_allowed_number,0);
- }
- Set_Trig_Source(i,source_hold);
+ // Set to PW to 500 ns, if possible.
+ // Wide enough to use PGC in AVR-E3-W3.
+ use_pw = MAX(globals.Flash.min_pw[i], 500e-9);
+ use_pw = MIN(globals.Flash.max_pw[i], use_pw);
+ do_toggle_pulse (i, use_pw);
- // trigger IL710 twice to initialize it
- Set_Output_State(i,output_on);
- Set_Trig_Source(i,source_immediate);
- Set_Trig_Source(i,source_immediate);
- Set_Output_State(i,output_off);
+ // also toggle narrow range model, if it exists
+ if ((use_pw > 7e-9) && (globals.Flash.min_pw[i] < 7e-9)) {
+ use_pw = globals.Flash.min_pw[i];
+ do_toggle_pulse (i, use_pw);
}
}
}