Bader
so just wondering if anyone had any quick tips 😁
Bader
it'll be used in conjunction with the Arduino IDE and stuff
Alignant
such a long function
Yeah, and guess what... this library has a function that accepts a pointer
hostmit
or cant I? I can prolly make a copy inside recepient fucntion... and make sure acquire will delete original pointer like in a 3 sec
Alignant
Do you like that? :D
BinaryByter
Ибраги́м
hostmit
why?
hostmit
am I that bad? :)
BinaryByter
am I that bad? :)
please split that function up into as many small functions as you can
BinaryByter
also, split your class into subclasses
Bader
Dima
The people who hate cxx just can’t figure out how it works
Dima
The only reason is that one.
BinaryByter
Dima
Or typical js coderz
hostmit
My C++ experience like 5 days :) I understand it has really different "Best Practices" apart from Node, C# :D
BinaryByter
yes
theres no reason to use C++ over C except for some edge cases @ollirz will point out for you
BinaryByter
BinaryByter
you NEVER want your function to be longer than 20 lines
hostmit
cause C++ doesnt allow nested fucntions :D
BinaryByter
it does
hostmit
does it?
BinaryByter
yes
hostmit
well subclasses maybe. void function () { void subfunction(){} } will yeld error
BinaryByter
BinaryByter
you can have nested funcitons
BinaryByter
except they have a different syntax
BinaryByter
(because they are lambdas)
BinaryByter
void functiony () {
auto f2 = [] () {
};
f2();
}
hostmit
okey, so I that's like 3rd time I meat that word :) have to google for
Ибраги́м
am I that bad? :)
Everybody needs improvement, even those sitting @ ISO C++ Committe High chair. YEs, Bjarne included.
BinaryByter
hostmit
yeah! castsing is hell! it was like whaaaat??? u cant do string = char[]+char[]? :D
BinaryByter
BinaryByter
why would you want to add two pointers?
hostmit
it was later I learned array = pointer
hostmit
would someone link me Arduino/Esp specific telegram channels?
BinaryByter
myArr whats that?
hostmit
he reffering to my code :)
hostmit
the way I used to pass data to void* accepting function :D
Dima
Dima
Lol
Dima
hostmit
how do I stop gif from autoplaying? :)
klimi
wel...
Ибраги́м
What does gpio_isr_handler_add do ?
klimi
Ибраги́м
hostmit
attach handler to GPIO on board. on change - it will fire up handleInterrupt()
hostmit
hostmit
oh boy I will get blamed again :)
hostmit
this function will be executed on GPIO change. I need to know which GPIO caused this function to invoke
hostmit
I've seen other, non working examples, ppl try to pass pointer to struct or vector, without calling "new" operator.
BinaryByter
hostmit
On rare ocassions, app will deattach handler and reattach new one. I dont think few "floating" int[3] arrays will eat up all memmory... more like a learning case how to solve this.
Dima
hostmit
split? why? how? may I see solid example?
klimi
and i thought anyone needs me
BinaryByter
I do
hostmit
no, cause by the time it get's to recepient function, caller is finished, memorry cleared, only 0 at that address
klimi
I do
i dont want more work
BinaryByter
no I meant
BinaryByter
I need you as a close friend :)
Ибраги́м
hostmit
I could probably could pass pointer to Classes's property (stuct) I have for each pin.
hostmit
I think I got solution. For every active GPIO i have own struct (few ints). Unless pin active - it always has that stuct. Before removing PIN from config, I remove all handlers... so I can do like this
hostmit
Ибраги́м
Wait it's the same data[]
hostmit
actually array of stucts, but doesnt matter. I will be sending Object static property
hostmit
yeah. the same I was getting values to happy myArray :D
Ибраги́м
Dima
O, I see AOS, think about data oriented approach
hostmit
well, that's Arduino... I dont have std:: implemented... vector partially