Improve comments

This commit is contained in:
Reinout Meliesie 2025-08-23 21:16:18 +02:00
commit 2cd8210527
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6

View file

@ -64,6 +64,8 @@ void loop () {
if ( Serial . available () ) { if ( Serial . available () ) {
int input = Serial . read () ; int input = Serial . read () ;
// In order to avoid serial writes by software other than kulifuli-host messing things up,
// we check for a specific sequence of 8 bytes before the byte that contains the new duty cycle
if ( if (
seqPos == 0 && input == 188 || seqPos == 0 && input == 188 ||
seqPos == 1 && input == 92 || seqPos == 1 && input == 92 ||
@ -77,7 +79,7 @@ void loop () {
// Advance in the sequence // Advance in the sequence
seqPos ++ ; seqPos ++ ;
} else if ( seqPos == 8 ) { } else if ( seqPos == 8 ) {
// `input` is the new duty cycle // Sequence completed, `input` is the new duty cycle
OCR1AL = input ; OCR1AL = input ;
OCR1BL = input ; OCR1BL = input ;
Serial . write (input) ; Serial . write (input) ;