SPI Library change causes multiple downstream breaks from Web IDE

I fear that this is something that I am doing incorrectly since I haven’t seen mention of it elsewhere in the community forums but here it goes.

The library lib/RFID-MFRC522/src/MFRC522.h included from the Web IDE causes the following error to be thrown:

error: use of deleted function 'SPIClass::SPIClass(const SPIClass&)'

whenever the library is included in a project. This is affecting a project of mine, which compiled fine up until 2 months ago. For tracking purposes, the easiest way to duplicate this problem is by trying to compile the program rfid-cloner.ino from the examples linked to the RFID library RFID-MFRC522.

In reality, the RFID library is the one that I need, but it is not directly the source of the problem.

This error is produced when compiling for the photon, revision 1.5.2 of the OS on either a Linux or mac machine, using Firefox as the browser.

This turns out to be a non-trivial problem to solve. It could be fixed with a library modification, but it’s more than a few lines of code.

The easiest temporary solution is to target 1.5.0 or earlier, which don’t have the SPI change.

The problem with the old way is that during global object construction it was previously possible to have more than once instance of the SPI object created, which causes chaos in the system. The solution was to create SPI object as a true singleton object, and the SPIProxy object does that, safely.

However, the way the MFRC522 library is using SPIClass it assumes that it’s a non-stateful wrapper that can be copied, which is not the case. The new SPIClass object is explicitly marked as non-copyable to prevent misuse, and that’s why your compile is failing.

So holding back to an earlier version of Device OS is the easiest fix for now.

1 Like

Easy as can be. Since this is a very preliminary project, I can afford to tread water until the various changes propagate upstream while doing dev work in 1.5.0

I compliment your team for having some of the best customer service I have encountered.


1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.