B4R Question Tuya Open: trying MCU LN882 in B4R

peacemaker

Expert
Licensed User
Longtime User
Hi, All

I'm trying to work with MCU LN882 that is supported by Tuya Open SDK for Arduino: https://github.com/tuya/arduino-tuyaopen/releases/download/global/package_tuya_open_index.json

First try to compile is with error:

B4R Version: 4.00
Parsing code. (0.00s)
Building folders structure. (0.00s)
Compiling code. (0.00s)
Building project (0.02s)
Compiling (LN882H) Error
In file included from C:\!\RMW002_LN882H\Objects\src\src.ino:1:
C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:11:10: fatal error: Client.h: No such file or directory
11 | #include <Client.h>
| ^~~~~~~~~~
compilation terminated.
Error during build: exit status 1

B4RDefines.h is


B4X:
#ifndef B4RDefines_h
#define B4RDefines_h

#define B4R_SERIAL
#define B4R_STANDARD_PROMOTIONS

#include <stdarg.h>
#include <Arduino.h>
#include <string.h>
#include <Print.h>
#include <Client.h>
#define AUTO_FLUSH_LOGS true
#define STACK_BUFFER_SIZE 300
#if defined(ESP_H) || PLATFORM_ID == 0xAE
    #define B4R_MEMORY_ALIGNMENT 3
#else
    #define B4R_MEMORY_ALIGNMENT 0
#endif
#define CHECK_ARRAY_BOUNDS


#include "rCore.h"


#include "b4r_main.h"

#endif

How to add this Client.h and other adoptations to go on?
 

peacemaker

Expert
Licensed User
Longtime User
Created empty "Client.h" file in the SDK folder "%user%\Arduino\Arduino15\packages\tuya_open\hardware\tuya_open\1.2.5\cores\tuya_open", compilation goes next up to:


B4X:
B4R Version: 4.00
Parsing code.    (0.00s)
Building folders structure.    (0.00s)
Compiling code.    (0.00s)
Building project    (0.02s)
Compiling (LN882H)    Error
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:24,
                 from C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:1:
C:\!\RMW002_LN882H\Objects\src\rCore.h:681:3: error: 'Client' does not name a type
  681 |   Client* wrappedClient = NULL;
      |   ^~~~~~
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp: In member function 'bool B4R::Object::equals(B4R::Object*)':
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:34:26: warning: implicit conversion from 'Double' {aka 'float'} to 'double' to match other operand of binary expression [-Wdouble-promotion]
   34 |     return o->toDouble() == atof((const char*)this->data.PointerField);
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:42:29: warning: implicit conversion from 'Double' {aka 'float'} to 'double' to match other operand of binary expression [-Wdouble-promotion]
   42 |     return this->toDouble() == atof((const char*)o->data.PointerField);
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp: In member function 'B4R::Object* B4R::Object::wrapNumber(double)':
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:73:28: warning: conversion from 'double' to 'Double' {aka 'float'} may change value [-Wfloat-conversion]
   73 |   this->data.DoubleField = d;
      |                            ^
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp: In member function 'Long B4R::Object::toLong()':
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:79:22: warning: conversion from 'Double' {aka 'float'} to 'Long' {aka 'long int'} may change value [-Wfloat-conversion]
   79 |    return this->data.DoubleField;
      |           ~~~~~~~~~~~^~~~~~~~~~~
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp: In member function 'ULong B4R::Object::toULong()':
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:84:22: warning: conversion from 'Double' {aka 'float'} to 'ULong' {aka 'long unsigned int'} may change value [-Wfloat-conversion]
   84 |    return this->data.DoubleField;
      |           ~~~~~~~~~~~^~~~~~~~~~~
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:7,
                 from C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:1:
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp: In member function 'B4R::Array* B4R::Array::create(void*, UInt, Byte, ...)':
C:\!\RMW002_LN882H\Objects\src\B4RCore.cpp:165:52: warning: conversion from 'double' to 'Double' {aka 'float'} may change value [-Wfloat-conversion]
  165 |      ((Double*) data)[index] = va_arg ( arguments, double);
      |                                                    ^
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:24,
                 from C:\!\RMW002_LN882H\Objects\src\Scheduler.cpp:2:
C:\!\RMW002_LN882H\Objects\src\rCore.h:681:3: error: 'Client' does not name a type
  681 |   Client* wrappedClient = NULL;
      |   ^~~~~~
C:\!\RMW002_LN882H\Objects\src\Scheduler.cpp: In member function 'void B4R::PollerList::runAll()':
C:\!\RMW002_LN882H\Objects\src\Scheduler.cpp:95:4: error: 'noInterrupts' was not declared in this scope; did you mean 'setInterrupt'?
   95 |    noInterrupts();
      |    ^~~~~~~~~~~~
      |    setInterrupt
C:\!\RMW002_LN882H\Objects\src\Scheduler.cpp:98:4: error: 'interrupts' was not declared in this scope; did you mean 'interruptFnc'?
   98 |    interrupts();
      |    ^~~~~~~~~~
      |    interruptFnc
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:24,
                 from C:\!\RMW002_LN882H\Objects\src\src.ino:1:
C:\!\RMW002_LN882H\Objects\src\rCore.h:681:3: error: 'Client' does not name a type
  681 |   Client* wrappedClient = NULL;
      |   ^~~~~~
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:24,
                 from C:\!\RMW002_LN882H\Objects\src\B4RArduino.cpp:1:
C:\!\RMW002_LN882H\Objects\src\rCore.h:681:3: error: 'Client' does not name a type
  681 |   Client* wrappedClient = NULL;
      |   ^~~~~~
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:24,
                 from C:\!\RMW002_LN882H\Objects\src\B4RStream.cpp:1:
C:\!\RMW002_LN882H\Objects\src\rCore.h:681:3: error: 'Client' does not name a type
  681 |   Client* wrappedClient = NULL;
      |   ^~~~~~
In file included from C:\!\RMW002_LN882H\Objects\src\B4RDefines.h:24,
                 from C:\!\RMW002_LN882H\Objects\src\b4r_main.cpp:1:
C:\!\RMW002_LN882H\Objects\src\rCore.h:681:3: error: 'Client' does not name a type
  681 |   Client* wrappedClient = NULL;
      |   ^~~~~~
Error during build: exit status 1

It looks like the SDK is not ready to be used with B4R...
It has a folder "api" with all files mentioned in the error log.

But in Arduino IDE the empty sketch is compiled OK.
 
Last edited:
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Look at this:


Based on this try to open the created arduino code in Arduino IDE and then delete the #inlude <Client.h>.

Then compile in Arduino.

There are also other suggestions in the conversations above.
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Then compile in Arduino.
The SDK has "api" folder with Client.h file and all others, even some "depricated" folder. But anyway using those files gives tons of compilation errors in B4R.
But directly in the Arduino IDE the empty sketch is compiled at once without Client.h and other files... Strange.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
An intuition (not tried as I am not in front of my computer) would be to reference the missing files with quotes and direct path:

C++:
#include "{full path where client.h is located}\Client.h"

Which are the other files that if they are removed the sketch compiles?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
I'd prefer some standard way to go on, like other MCU with correct SDK architecture.
If interesting - please, try to install the SDK and try to make just compilation of the empty project - and reply here how many troubles you get - i mean - if is there any use to try to use this MCU SDK in whole.

Maybe better just give it up.
 
Upvote 0
Top