Archived
1
0

added more documentation to function chords and updated protocol-setting chords

This commit is contained in:
Emanuele Caruso 2014-05-08 13:09:07 +02:00
parent f26ff42745
commit c43fce9d58

44
StenoFW.ino Normal file → Executable file
View File

@ -353,21 +353,51 @@ void sendChord() {
} }
} }
// This function is called when only "fn1" key has been pressed. // Fn1 functions
//
// This function is called when "fn1" key has been pressed, but not "fn2".
// Tip: maybe it is better to avoid using "fn1" key alone in order to avoid
// accidental activation?
//
// Current functions:
// PH-G -> Set Gemini PR protocol mode
// PH-B -> Set TX Bolt protocol mode
void fn1() { void fn1() {
protocol = GEMINI; // "PH" -> Set protocol
if (currentChord[0][2] && currentChord[0][3]) {
// "-G" -> Gemini PR
if (currentChord[4][2]) {
protocol = GEMINI;
}
// "-B" -> TX Bolt
if (currentChord[4][1]) {
protocol = TXBOLT;
}
}
} }
// This function is called when only "fn2" key has been pressed. // Fn2 functions
//
// This function is called when "fn2" key has been pressed, but not "fn1".
// Tip: maybe it is better to avoid using "fn2" key alone in order to avoid
// accidental activation?
//
// Current functions: none.
void fn2() { void fn2() {
protocol = TXBOLT;
} }
// This function is called when both "fn1" and "fn1" key has been pressed. // Fn1-Fn2 functions
//
// This function is called when both "fn1" and "fn1" keys have been pressed.
//
// Current functions:
// HR-P -> LED intensity up
// HR-F -> LED intensity down
void fn1fn2() { void fn1fn2() {
// "HR" -> Change LED intensity // "HR" -> Change LED intensity
if (currentChord[0][3] && currentChord[1][3]) { if (currentChord[0][3] && currentChord[1][3]) {
// "P" -> LED intensity up // "-P" -> LED intensity up
if (currentChord[3][1]) { if (currentChord[3][1]) {
if (ledIntensity == 0) ledIntensity +=1; if (ledIntensity == 0) ledIntensity +=1;
else if(ledIntensity < 50) ledIntensity += 10; else if(ledIntensity < 50) ledIntensity += 10;
@ -375,7 +405,7 @@ void fn1fn2() {
if (ledIntensity > 255) ledIntensity = 0; if (ledIntensity > 255) ledIntensity = 0;
analogWrite(ledPin, ledIntensity); analogWrite(ledPin, ledIntensity);
} }
// "F" -> LED intensity down // "-F" -> LED intensity down
if (currentChord[3][0]) { if (currentChord[3][0]) {
if(ledIntensity == 0) ledIntensity = 255; if(ledIntensity == 0) ledIntensity = 255;
else if(ledIntensity < 50) ledIntensity -= 10; else if(ledIntensity < 50) ledIntensity -= 10;