[LinuxCNC/linuxcnc PR#55] add bitbang spi driver for the max31855 thermocouple to digital conve…

未分类 bolang 4个月前 (10-15) 22次浏览

Issue #55 | 状态: 已关闭 | 作者: sleepybishop | 创建时间: 2016-04-16


Signed-off-by: joseph calderon calderon.joe@gmail.com

This comp adds support for the max31855 thermocouple to digital converter using a bitbanged spi interface.

see this forum thread for more context:
http://forum.linuxcnc.org/forum/10-advanced-configuration/30676-best-way-to-do-temperature-pid-with-linuxcnc


评论 (10)

#1 – SebKuzminsky 于 2016-04-17

Unfortunately an annoying wrinkle in our .comp build system prevents the component from building on uspace configurations. I’m guessing you’re developing on an RTAI machine?

I moved the comp to src/hal/components, where it’ll get built for both rtai and uspace configs. If the buildbot doesn’t reveal any other issues i’ll push it to master. It’s in the sleepybishop-max31855 branch for now: https://github.com/LinuxCNC/linuxcnc/commits/sleepybishop-max31855

Thanks for the PR.


#2 – jepler 于 2016-06-12

Seb’s branch encounters an error on some of the systems in our CI (buildbot) system:
http://buildbot.linuxcnc.org/buildbot/builders/1301.rip-precise-rtai-i386/builds/3408/steps/compile/logs/stdio
http://buildbot.linuxcnc.org/buildbot/builders/1902.clang-wheezy-rtai-i386/builds/1351/steps/compile/logs/stdio

hal/components/max31855.comp: In function ‘read_celsius’:
hal/components/max31855.comp:70:12: error: ‘NAN’ undeclared (first use in this function)
hal/components/max31855.comp:70:12: note: each undeclared identifier is reported only once for each function it appears in
...

C99 specifies the nan function in but we don’t support it in math.h>. It looks like it would be trivial to add there, just using builtinnan(), untested:

// add to the if defined(KERNEL) block
#define nan(x) _builtinnan(x)

and then change your code to use nan("") instead of NAN. I’ve done this, and rebased the branch on top of our current master, to let buildbot chew on it again.


#3 – sleepybishop 于 2016-06-12

you mean in rtapi_math.h ?

the max31855 component uses both isnan() and the NAN macro, isnan() seems to be handled in rtapi_math.h, the NAN macro is not, gnu c seems to define this macro as:
#define NAN _builtinnanf(""):

i have no preference either way but would it make sense to define it similarly in rtapi_math.h?

happy to make any changes needed.


#4 – jepler 于 2016-06-12

Yes, rtapi_math.h. after that the next problem is with the exp() function. I’ll look into it a bit more.


#5 – jepler 于 2016-06-12

http://buildbot.linuxcnc.org/buildbot/builders/1401.rip-wheezy-rtai-i386/builds/2025/steps/compile/logs/stdio

hal/components/max31855.comp: In function ‘readcelsiusadjusted’:
hal/components/max31855.comp:129:5: error: implicit declaration of function ‘exp’ [-Werror=implicit-function-declaration]


#6 – sleepybishop 于 2016-06-13

wrt to the exp() function, similar issue, pow() is defined but exp() is not, i think a
extern double exp(double);
would fix it


#7 – jepler 于 2016-06-13

Yes, now the rtai-based systems are happy. @SebKuzminsky what else needs to happen before merging this to master?


#8 – SebKuzminsky 于 2016-06-13

The merge is @mozmck’s call, he’s the release manager for 2.7+1, but it looks good to me.

My only comment is, should nan() and exp() be added to tests/realtime-math? Or will that croak on some subset of our RTAI platforms?


#9 – SebKuzminsky 于 2016-06-13

After 75c2329b7b6502 i have no reservations.


#10 – jepler 于 2016-06-13

@mozmck gave the OK on IRC, so this is now merged into our master branch. It’ll appear on github shortly.


原始Issue: https://github.com/LinuxCNC/linuxcnc/pull/55

喜欢 (0)