1

I was trying to follow this tutorial and ran into a problem compiling on the Arduino IDE with an ESP32 board. https://eloquentarduino.github.io/2019/12/how-to-do-gesture-identification-on-arduino/

I end up getting multiple lines of error from Arduino saying:

Error: operand 2 of 'l32r' has out of range value '4294704916'

The code that its struggling to compile is the converted SVM model generated from SciPy. The file is very long, but here is a snippet of what it looks like:

#include "model.h"
#include <cstdarg>

int SVM::predict(float *x) {
    float kernels[92] = { 0 };
    float decisions[21] = { 0 };
    int votes[7] = { 0 };
    kernels[0] = compute_kernel(x,   1.2  , -1.79  , -1.1  , 1.22  , -1.36  , 0.26  , 1.0  , -1.57  , -0.81  , 1.08  , -1.45  , -0.18  , 1.18  , -1.77  , -0.31  , 1.59  , -1.69  , 0.55  , 6.74  , 0.71  , -13.06  , 6.31  , 12.0  , -4.34  , 1.55  , -0.16  , 0.0  , 1.38  , 1.91  , 1.02  , 0.96  , -2.28  , -0.45  , 1.3  , -2.12  , -0.49  , 0.83  , -0.18  , -0.79  , 0.92  , -0.73  , 1.34  , 2.59  , -4.15  , -3.4  , 2.22  , -0.2  , 1.41  , 0.61  , -3.91  , -1.39  , 9.29  , 1.85  , -16.0  , 2.4  , -1.02  , -0.75  , 1.87  , 0.18  , 0.47  , 1.38  , -2.06  , 0.06  , 1.32  , -2.16  , 0.1  , 1.63  , -2.2  , -0.16  , 1.47  , -1.49  , -0.08  , 0.98  , -1.51  , -0.55  , 1.3  , -1.53  , -0.12  , 1.32  , -1.61  , -0.47  , 1.18  , -1.26  , -0.2  , 1.43  , -1.06  , 0.06  , 1.3  , -1.18  , -0.59  , 0.94  , -0.1  , 1.04  , 1.28  , -1.41  , -0.55  , 1.26  , -1.3  , -0.18  , 1.28  , -1.65  , -0.39  , 1.26  , -1.36  , 0.63  , 1.45  , -1.45  , -0.57  , 1.65  , -1.32  , -0.63  , 1.3  , -1.28  , -0.35  , 1.22  , -1.3  , -0.31  , 1.22  , -1.02  , 0.16  , 1.12  , -1.43  , -0.39  , 1.1  , -0.96  , 0.43  , 0.92  , -1.12  , -0.37  , 1.24  , -0.86  , 0.0  , 1.1  , -1.12  , -0.24  , 1.12  , -1.34  , -0.2  , 1.16  , -1.14  , -0.1  , 1.14  , -1.12  , -0.24  , 1.24  , -1.1  , -0.26  , 1.16  , -1.39  , -0.24 );
    kernels[1] = compute_kernel(x,   1.1  , 0.24  , 9.49  , -11.73  , -9.12  , 9.63  , -2.5  , -5.48  , 1.87  , 1.53  , -1.14  , 0.96  , 0.79  , -1.96  , -0.75  , 0.55  , -1.61  , -1.39  , 1.41  , -1.91  , -0.57  , 0.88  , -2.1  , 0.2  , 0.29  , -2.22  , 0.73  , 1.69  , 0.45  , -0.14  , 2.08  , -1.89  , 1.0  , 1.16  , 0.84  , 1.59  , 1.45  , -2.36  , -0.83  , 2.36  , -0.71  , 0.61  , -9.51  , -16.0  , 6.13  , 2.61  , 1.18  , 0.77  , 0.69  , 0.63  , -0.96  , 1.0  , -0.67  , -0.02  , 1.57  , -1.08  , 0.2  , 1.14  , -1.47  , -0.08  , 1.57  , -1.93  , -0.22  , 1.18  , -1.36  , -0.57  , 1.57  , -1.39  , 0.71  , 1.16  , -1.55  , -0.65  , 1.04  , -1.12  , -0.77  , 1.55  , -2.12  , 0.67  , 1.57  , -0.86  , -0.75  , 1.41  , -1.2  , 0.53  , 1.55  , -1.39  , -0.83  , 1.32  , -0.75  , 0.59  , 1.67  , -1.49  , -0.55  , 1.65  , -1.51  , -0.49  , 1.36  , -1.16  , -0.02  , 1.63  , -1.22  , -0.35  , 1.49  , -1.2  , -0.26  , 1.38  , -1.32  , -0.02  , 1.39  , -1.22  , -0.12  , 1.41  , -1.0  , -0.1  , 1.43  , -1.18  , -0.14  , 1.41  , -1.22  , -0.02  , 1.55  , -1.3  , -0.33  , 1.45  , -1.2  , -0.24  , 1.38  , -1.3  , -0.26  , 1.38  , -1.28  , -0.12  , 1.3  , -1.06  , -0.12  , 1.39  , -1.32  , -0.2  , 1.39  , -1.22  , -0.18  , 1.43  , -1.1  , -0.24  , 1.43  , -1.32  , -0.33  , 1.45  , -1.08  , -0.37 );
    kernels[2] = compute_kernel(x,   1.55  , -1.67  , -2.16  , 1.59  , -0.04  , 1.16  , 1.38  , -2.71  , -1.06  , 2.04  , 1.41  , 1.49  , 1.16  , -0.67  , 6.66  , 0.79  , -7.94  , 8.51  , 2.4  , -0.41  , 2.32  , 1.45  , -0.37  , 0.0  , 1.61  , -1.67  , -0.28  , 2.04  , -0.96  , -0.57  , 1.04  , -0.83  , 0.61  , 1.38  , -1.08  , -0.33  , 1.65  , -0.24  , -1.96  , 2.06  , -2.99  , -0.92  , 8.31  , 4.83  , 2.3  , 4.79  , -3.89  , -5.38  , 0.67  , -2.67  , 1.2  , 3.03  , 1.41  , -0.86  , 2.36  , -1.85  , -1.32  , 2.32  , -1.32  , 0.75  , 1.69  , -1.2  , -0.35  , 1.28  , -1.04  , 0.22  , 1.28  , -1.12  , -0.37  , 1.87  , -1.14  , 0.33  , 1.83  , -1.24  , -0.26  , 1.77  , -0.94  , -0.51  , 1.63  , -0.79  , 0.22  , 1.47 
//and so on
decisions[0] = 1.245222806707
    + kernels[1] * 0.00090445776
    + kernels[2] * 0.000488112628
    + kernels[8] * 0.000123322494
//and so on

I have the following flags enabled on the compiler:

compiler.c.extra_flags=-mlongcalls -mtext-section-literals

It just won't compile for some reason and gives me the same l32r message. Can someone please help? Much is appreciated.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.