Skip to content

Conversation

@pwnage101
Copy link

Before this commit, I couldn't compile with a SAMD21 chip because of the following error:

/home/sankey/Arduino/libraries/IRLibProtocols/IRLibSAMD21.cpp:108:1: error: narrowing conversion of '(_ETCChannel)-1' from 'short int' to 'uint8_t {aka
 unsigned char}' inside { } [-Wnarrowing]                                                                                                              
 };                                                                                                                                                    
 ^                                                                                                                                                     

Not saying this is the correct way to fix the error, it's just how I solved it.

Minimal code example is based on one of the checked-in examples, and is what I used to test this PR:

#include <IRLibDecodeBase.h>
#include <IRLib_P02_Sony.h>
#include <IRLibCombo.h>
IRdecode myDecoder;

#include <IRLibRecv.h> 
IRrecv myReceiver(6);  //pin number for the receiver

void setup() {
  Serial.begin(9600);
  delay(2000); while (!Serial); //delay for Leonardo
  myReceiver.enableIRIn(); // Start the receiver
  Serial.println(F("Ready to receive IR signals"));
}
void loop() {
  //Continue looping until you get a complete signal received
  if (myReceiver.getResults()) { 
    myDecoder.decode();           //Decode it
    myDecoder.dumpResults(true);  //Now print results. Use false for less detail
    myReceiver.enableIRIn();      //Restart receiver
  }
}

@cyborg5
Copy link
Owner

cyborg5 commented Apr 4, 2020

The correct fix is to change

uint8_t IR_PER_EorF;

to

int8_t IR_PER_EorF;

in IRLibSAMD21.cpp at approximately line 30. I will fix it soon but I need to double check on something else first.

kylefmohr added a commit to kylefmohr/IRLib2 that referenced this pull request Sep 18, 2021
@pwnage101 pwnage101 closed this May 15, 2025
@pwnage101 pwnage101 reopened this May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants