Skip to content

Commit 14f4e10

Browse files
committed
Start to adapt signal code to support both piezo and relay (pulse or switch) outputs
1 parent 524510a commit 14f4e10

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

sixtube_lm/sixtube_lm.ino

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const char mainAdjFn = -1;
5757
// const byte altSelFn = -1;
5858
// const byte altAdjFn = -1;
5959

60+
///////TODO SEARCH FOR THESE ////////////////
6061
const byte signalPin = 10;
6162
const byte signalType = 0; //What is the signal pin connected to?
6263
// 0 = Piezo. When alarm and timer go off, it will output a beep pattern with tone() for signalDur seconds.
@@ -66,12 +67,30 @@ const word signalDur = 180; //Per above. Use e.g. 180 secs (3min) for signalType
6667
const word signalBeepDur = 500; //With signalType 0/1, "beeps" happen once per second; how long is each beep in ms?
6768
//Particularly when driving a solenoid with signalType 1, this should be set to a comfortable activation duration for the solenoid.
6869

70+
//What are the signal pin(s) connected to?
71+
const char piezoPin = 10;
72+
const char relayPin = -1;
73+
//If running a v5.0 board with only a piezo output, leave these set to 10 and -1 (disabled) respectively - unless removing the piezo to drive a relay instead, in which case, reverse them.
74+
//If running a v5.x board, piezo is 10, relay is X.
75+
const byte relayMode = 0; //what does the relay pin do?
76+
//0 = switch (for e.g. appliance/radio) - see switchDur
77+
//1 = pulses (for e.g. solenoid) - see relayPulse
78+
const word signalDur = 180; //sec - when alarm or timer go off (piezo or relay pulse), pulses are sent once/sec for this many seconds (e.g. 180 = 3min)
79+
const word switchDur = 7200; //sec - when alarm goes off (relay switch), relay is switched for this many seconds (e.g. 7200 = 2hr)
80+
const word piezoPulse = 500; //ms - used with tone()
81+
const word relayPulse = 200; //ms - for pulsing e.g. a solenoid
82+
//If both piezo and relay are equipped, you get these extra menu options:
83+
//alarm signal: 0: piezo, 1: relay (pulse or switch for wake)
84+
//timer mode: 0: countdown and stop, 1: countdown and restart (interval timer)
85+
//timer signal: 0: piezo, 1: relay (pulse or switch for sleep)
86+
//strike signal (if relayMode is pulse): 0: piezo, 1: relay pulse
87+
6988
const byte enableSoftAlarmSwitch = 1;
7089
// 1 = yes (normal). Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
7190
// 0 = no. Alarm will be permanently on. Use with signalType=2 if the connected device has its own switch.
7291
const byte enableSoftPowerSwitch = 0;
7392
// 0 = no (normal).
74-
// 1 = yes. If signalType=2, this allows the relay to be switched on and off when clock is displaying time of day (fnIsTime). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in an old clock radio of the type where the clock does all the switching.
93+
// 1 = yes. If relay equipped in switch mode, this allows the relay to be switched on and off directly when clock is displaying time of day (fnIsTime). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in an old clock radio of the type where the clock does all the switching.
7594

7695
const byte unoffDur = 10; //when display is dim/off, a press will light the tubes for this many seconds
7796

@@ -129,6 +148,9 @@ Some are skipped when they wouldn't apply to a given clock's hardware config; se
129148
39 Alarm tone pitch - skipped when signalType!=0
130149
40 Timer tone pitch - skipped when signalType!=0
131150
41 Hourly strike pitch - skipped when signalType!=0
151+
42 Alarm signal type - skipped when not both piezo and relay TODO
152+
43 Timer signal type - ditto TODO
153+
44 Strike signal type - skip if not relay pulse TODO
132154
*/
133155

134156
//Options menu options' EEPROM locations and default/min/max values.

0 commit comments

Comments
 (0)