X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=rf433ctl%2Frf433ctl.pde;fp=rf433ctl%2Frf433ctl.pde;h=68d9f08eecf2d8e9028a7ea4202bcafa53ae340d;hb=1b475c3656ae87f9f9d6cc9420b6c80f53eb00ef;hp=05ff60a327413b6afdc910b6cf78444700b29620;hpb=5d6e4e72cd5d0d67f969f41a438b58815e85c100;p=svn42.git diff --git a/rf433ctl/rf433ctl.pde b/rf433ctl/rf433ctl.pde index 05ff60a..68d9f08 100644 --- a/rf433ctl/rf433ctl.pde +++ b/rf433ctl/rf433ctl.pde @@ -80,17 +80,6 @@ const char YAMAHA_EFFECT5 =0x91; //Effect Toggle 70mm Sci-Fi / 70mm Spectacle const char YAMAHA_EFFECT6 =0x51; //Effect Toggle 70mm General / 70mm Adventure const char YAMAHA_P5 =0xFB; //P5 PRT (1 Main Bypass)? (1587674115) - -void send_yamaha_ir_signal(char codebyte) -{ - unsigned long int code = codebyte & 0xFF; - code <<= 8; - code |= (0xff ^ codebyte) & 0xFF; - code |= YAMAHA_CODE_BASE; - irsend.sendNEC(code,YAMAHA_CODE_BITS); - Serial.println("Ok"); -} - //********************************************************************// typedef struct { @@ -393,6 +382,31 @@ void flash_led(unsigned int times, unsigned int brightness_divisor, unsigned int //********************************************************************// +void send_yamaha_ir_signal(char codebyte) +{ + unsigned long int code = codebyte & 0xFF; + code <<= 8; + code |= (0xff ^ codebyte) & 0xFF; + code |= YAMAHA_CODE_BASE; + + //irsend changes PWM Timer Frequency among other things + //.. doesn't go well with PWM output using the same timer + //.. thus we just set output to 255 so whatever frequency is used, led is off for the duration + unsigned int flash_prev_selected = flash_led_selected_; //save prev. selected leds + flash_led_selected_ &= !(1 << BLUELED_PWM_PIN); //prevent calculate_led_level() from setting blueled + analogWrite(BLUELED_PWM_PIN,255); // switch led off + + irsend.sendNEC(code,YAMAHA_CODE_BITS); + + analogWrite(BLUELED_PWM_PIN,255); // switch off led again to be sure + flash_led_selected_ = flash_prev_selected; //restore led settings for calculate_led_level() + //is actually not necessary, since we are not multitasking/using interrupts, but just to be sure in case this might change + + Serial.println("Ok"); +} + +//********************************************************************// + void setup() { pinMode(RF_DATA_OUT_PIN, OUTPUT);