Hello, I know that the project is a little old but I encountered an error that I do not understand during compilation, below are the errors encountered with the project in v0.7 .
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino: In function 'int keeloq()':
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino:453:1: error: no return statement in function returning non-void [-Werror=return-type]
453 | } // int keeloq
| ^
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino: In function 'int keygen()':
D:\PATH\TOs\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino:479:1: error: no return statement in function returning non-void [-Werror=return-type]
479 | } // int keygen
| ^
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino: In function 'int rx_keygen()':
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino:641:1: error: no return statement in function returning non-void [-Werror=return-type]
641 | } // int rx_keygen
| ^
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino: In function 'int rx_decoder()':
D:\PATH\TO\Jarolift_MQTT-0.7-2\Jarolift_MQTT-0.7\Jarolift_MQTT\Jarolift_MQTT.ino:654:1: error: no return statement in function returning non-void [-Werror=return-type]
654 | } // int rx_decoder
| ^
cc1plus.exe: some warnings being treated as errors
exit status 1
Compilation error: no return statement in function returning non-void [-Werror=return-type]
I know, hence my question as to which board is being used.
I have had to fix the unused variable warning being treated as an error "feature" many times when updating the ESP32 board files but the latest did not need fixing. Hence my question as to which board version was being used
C:\Users\Bob2\AppData\Local\Temp\.arduinoIDE-unsaved2024323-2904-gxlna6.6djjj\sketch_apr23b\sketch_apr23b.ino: In function 'bool test()':
C:\Users\Bob2\AppData\Local\Temp\.arduinoIDE-unsaved2024323-2904-gxlna6.6djjj\sketch_apr23b\sketch_apr23b.ino:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
but the sketch causes the board to boot loop.
Setting the return type of the function to void makes the sketch behave as expected
My conclusion is that the situation is not as clear cut as it could be
If the code is likely to cause a reboot, as opposed to just not doing what is required, then I would call that an error and prevent the program running
As it is you get a warning and a reboot
Q: When is a warning not a warning ?
A: When it is an error
Much more interesting than arguing about the classification of the error (warning), is the reason for it. As @blastmun already pointed out, the latest and greatest version of the GitHub code is different than Release v0.7 (that was originally tested).
Rev v0.7 has this ... which is clearly the problem:
//####################################################################
// Generation of the encrypted message (Hopcode)
//####################################################################
int keeloq () {
Keeloq k(device_key_msb, device_key_lsb);
unsigned int result = (disc << 16) | devcnt; // Append counter value to discrimination value
dec = k.encrypt(result);
} // int keeloq
It has since been changed to:
//####################################################################
// Generation of the encrypted message (Hopcode)
//####################################################################
void keeloq () {
Keeloq k(device_key_msb, device_key_lsb);
unsigned int result = (disc << 16) | devcnt; // Append counter value to discrimination value
dec = k.encrypt(result);
} // void keeloq
Maybe, but when unused variables were regarded as errors it was a nonsense. Easy to put right in your own code but it also caused problems with some libraries. Thankfully that seems to have been changed so that unused variables are now warnings, although I assume that the compiler removes the declaration/definition anyway