Skip to content

Commit 63007cb

Browse files
committed
More updates for pulse divider
1 parent 31f4e21 commit 63007cb

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

RFControl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ void afterTalk()
518518
}
519519
}
520520

521-
void delayMicrosecondsLong(unsigned int time_to_wait){
521+
void delayMicrosecondsLong(unsigned long time_to_wait){
522522
// delayMicroseconds() only works up to 16383 micros
523523
// https://github.com/pimatic/rfcontroljs/issues/29#issuecomment-85460916
524524
while(time_to_wait > 16000) {
@@ -529,7 +529,7 @@ void delayMicrosecondsLong(unsigned int time_to_wait){
529529
}
530530

531531

532-
void RFControl::sendByCompressedTimings(int transmitterPin,unsigned int* buckets, char* compressTimings, unsigned int repeats) {
532+
void RFControl::sendByCompressedTimings(int transmitterPin,unsigned long* buckets, char* compressTimings, unsigned int repeats) {
533533
listenBeforeTalk();
534534
unsigned int timings_size = strlen(compressTimings);
535535
pinMode(transmitterPin, OUTPUT);

RFControl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RFControl
2323
static bool compressTimings(unsigned int buckets[8], unsigned int *timings, unsigned int timings_size);
2424
static bool compressTimingsAndSortBuckets(unsigned int buckets[8], unsigned int *timings, unsigned int timings_size);
2525
static void sendByTimings(int transmitterPin, unsigned int *timings, unsigned int timings_size, unsigned int repeats = 3);
26-
static void sendByCompressedTimings(int transmitterPin, unsigned int* buckets, char* compressTimings, unsigned int repeats = 3);
26+
static void sendByCompressedTimings(int transmitterPin, unsigned long* buckets, char* compressTimings, unsigned int repeats = 3);
2727
static unsigned int getLastDuration();
2828
static bool existNewDuration();
2929
private:

examples/compressed/compressed.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ void loop() {
1414
RFControl::compressTimings(buckets, timings, timings_size);
1515
Serial.print("b: ");
1616
for(int i=0; i < 8; i++) {
17-
Serial.print(buckets[i]);
17+
unsigned long bucket = buckets[i] * pulse_length_divider;
18+
Serial.print(bucket);
1819
Serial.write(' ');
1920
}
2021
Serial.print("\nt: ");

examples/simple/simple.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ void setup() {
88
void loop() {
99
if(RFControl::hasData()) {
1010
unsigned int *timings;
11-
unsigned int timings_size;
11+
unsigned int pulse_length_divider = RFControl::getPulseLengthDivider();
1212
RFControl::getRaw(&timings, &timings_size);
1313
for(int i=0; i < timings_size; i++) {
14-
Serial.print(timings[i]);
14+
unsigned long timing = timings[i] * pulse_length_divider;
15+
Serial.print(timing);
1516
Serial.write(' ');
1617
if((i+1)%16 == 0) {
1718
Serial.write('\n');

0 commit comments

Comments
 (0)