Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Me No Dev
@me-no-dev
see the example in the PR
Clemens Kirchgatterer
@everslick
great. thank you very much
Me No Dev
@me-no-dev
thanbks for asking for it :D we should have added this long time ago
Mehrdad K
@mkeyno
hi @igrr are you there
is anyone hear
I really appreciated if any one could help me about the casting issue
virtual size_t fs::File::readBytes(char*, size_t) define in FS class of
I have problem to use readBytes for reading the byte type
f.readBytes( ((byte*)leds) + i, 144);
Mehrdad K
@mkeyno
where should I recasting the variable
Ivan Grokhotkov
@igrr
how is leds variable defined?
Mehrdad K
@mkeyno
this is object form fastLED lib CRGB leds[144];
consist of 3 byte R,G,B
Ivan Grokhotkov
@igrr
what is i?
Mehrdad K
@mkeyno
the location
actually this is the code line i += FILe.readBytes( ((byte*)leds) + i, (NUM_LEDS*3)-i);
it supposed to read one 144*3 byte of data from file and fed it to the LED array to display
the compiler says , I should casted to char
Ivan Grokhotkov
@igrr
can you please paste the actual error compiler produces?
Mehrdad K
@mkeyno
invalid conversion from 'byte {aka unsigned char}' to 'char*' [-fpermissive]
            i += FILe.readBytes( ((byte*)leds) + i, (NUM_LEDS*3)-i);
Ivan Grokhotkov
@igrr
okay
Mehrdad K
@mkeyno
should I override it
Ivan Grokhotkov
@igrr
so you have found the declaration of readBytes function, right?
virtual size_t fs::File::readBytes(char*, size_t)
Mehrdad K
@mkeyno
yes
Ivan Grokhotkov
@igrr
what type does it take as its first argument?
Mehrdad K
@mkeyno
I need byte for each R, G,B color
Ivan Grokhotkov
@igrr
what type does readBytes function take as its first argument?
Mehrdad K
@mkeyno
GRGB type , this is object from fastLED repo
Ivan Grokhotkov
@igrr
incorrect :)
look at readBytes function prototype again
Mehrdad K
@mkeyno
I know , but it work with char , and used many times in fastLED to read bytes
I don't know how but its work if casted to char
Ivan Grokhotkov
@igrr
so which type do you need to pass into this function if it takes char*?
Mehrdad K
@mkeyno
byte*
FILe.readBytes( ((char*)leds) + i, (NUM_LEDS*3)-i); this worked
Ivan Grokhotkov
@igrr
nope, look at the function prototype again :)
virtual size_t fs::File::readBytes(char*, size_t)
which type does it take?
Mehrdad K
@mkeyno
whereas define CRGB leds[NUM_LEDS];
Ivan Grokhotkov
@igrr
virtual size_t fs::File::readBytes(char*, size_t)
it takes char*
so you should cast to char*
Mehrdad K
@mkeyno
can I override it to byte
Ivan Grokhotkov
@igrr
no
just cast to char*
Mehrdad K
@mkeyno
but people use this function in FastLED repo to read bytes of data and fed it to LED.show() function
why can't override it to byte
FWeinb
@FWeinb
As far as I can see in the documentation they do cast it to (char*). See this.
Ivan Grokhotkov
@igrr
char is the same size as byte
Mehrdad K
@mkeyno
I know but we need all 255 range of color and char range -127 to 127
I should ask them how they do it