B4R Question FastPID Library Wrapper error

KiloBravo

Active Member
Licensed User
Continuing to try and wrap my first library. I would really appreciate some help if anyone can let me know what I am doing wrong. I tried to use a few other library wrappers as guides but no luck so far( rNewPing for one ). On a positive note the rFastPID library looks good in B4X Object Browser. I zipped the files rFastPID xml, and the 2 h and 2 cpp files below.
The FastPID library works in Arduino 1.8.12 (tried verify/compile) with the voltage regulator example sketch with a ESP8266 board selected.
The source for the Arduino library is here https://github.com/mike-matera/FastPID

Verifying...
2020-05-08T03:10:28.374Z INFO c.a.u.n.HttpConnectionManager:152 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Request complete URL="https://builder.arduino.cc/builder/v1/boards/0x1A86/0x7523", method=GET, response code=404, request id=263E9AE93695458F, headers={null=[HTTP/1.1 404 Not Found], Cache-Control=[no-cache, no-store, must-revalidate], Server=[nginx], Connection=[keep-alive], Vary=[Origin], Pragma=[no-cache], Expires=[0], Content-Length=[0], Date=[Fri, 08 May 2020 03:10:28 GMT]}
2020-05-08T03:10:28.374Z WARN p.a.h.BoardCloudResolver:64 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Fail to get the Vid Pid information from the builder response code=404
In file included from D:\B4R\B4R_Projects\rFastPID\Objects\bin\sketch\B4RDefines.h:25:0,
from D:\B4R\B4R_Projects\rFastPID\Objects\bin\sketch\B4RArduino.cpp:1:
rFastPID.h:13:27: error: 'FastPID' was not declared in this scope
uint8_t backend[sizeof(FastPID)];
^
rFastPID.h:16:3: error: 'FastPID' does not name a type
FastPID* fpid;

Bunch of errors follow but I would guess they are all caused from the above first error.
 

Attachments

  • rFastPID.zip
    3.8 KB · Views: 302

KiloBravo

Active Member
Licensed User
Come on 21 views and no replies ??? Just Kidding :cool:
I FINALLY have the library wrapper I wrote compiling and running on the esp8266.

B4X:
#pragma once
#include "B4RDefines.h"
#include "FastPID.h"

namespace B4R {
    
//~Version: 1.00
//~shortname: FastPID
    class B4RFastPID {
        private:
            uint8_t beFpid[sizeof(FastPID)];
            FastPID* fpid;
        public:
        void Initialize(float kp, float ki, float kd, float hz, int bits, bool sign);

B4X:
#include "B4RDefines.h"

namespace B4R {
    void B4RFastPID::Initialize(float kp, float ki, float kd, float hz, int bits, bool sign) {
        fpid =  new (beFpid) FastPID(kp, ki, kd, hz, bits, sign);
        fpid-> clear();

    } // End intialize

Ended up reading this post from Erel, among 50 other posts on wrappers and C/C++ code ...

In the end, I think I had some of the references as FastPid and not FastPID.
I believe I was also missing the #include "FastPID.h" in my rFastPID.h file.

I "started" trying to wrap a PID library a year ago and it got put on the shelf for other work and family stuff.
Now I get to see if my wrapped library actually works for my intended purpose.

I almost gave up a couple of times, but hey life is about the journey, not the destination, right ?
Be Well with B4R ! LOL or should that be, B4X !
 
Upvote 0
Top