ramapcsx2 / gbs-control

GNU General Public License v3.0
788 stars 110 forks source link

Can't compile; framesync.h error #245

Closed Roy12321334 closed 3 years ago

Roy12321334 commented 3 years ago

In file included from C:\Users\me\Documents\Arduino\gbs-control\gbs-control.ino:20: C:\Users\me\Documents\Arduino\gbs-control\framesync.h: In static member function 'static bool FrameSyncManager<GBS, Attrs>::findBestHTotal(uint32_t&)': framesync.h:148:33: error: call of overloaded 'abs(uint32_t)' is ambiguous 148 | if (abs(inPeriod - outPeriod) <= 4) { | ^

gingerbeardman commented 3 years ago

That line of code was last modified 17 months ago, so I think it's possible to compile or inability to do so would have been spotted by now.

https://github.com/ramapcsx2/gbs-control/blame/b9265e4025730aff7e0a4dbb82ac862eb9ba1b6a/framesync.h#L148

Please check your compilation method.

godzivan commented 3 years ago

Roy12321334 he is right, as reported on the arduino site: https://www.arduino.cc/reference/en/language/functions/math/abs/

this is the fix :

int32_t ttemp;
// allow ~4 negative (inPeriod is < outPeriod) clock cycles jitter 
ttemp=inPeriod - outPeriod;
if (abs(ttemp) <= 4) {
//if (abs(inPeriod - outPeriod) <= 4) {
TioChico27 commented 3 years ago

I got that same error yesterday. Try to use the Esp8266 version 2.7.4 library insted of 3.0.0, this resolved the issue here.

godzivan commented 3 years ago

it's still a bug, my solution is correct

gingerbeardman commented 3 years ago

Thanks @godzivan could you please submit a PR with the fix?