sensslen / LibLanc

Arduino Library to communicate to Lanc enabled Cameras
MIT License
17 stars 2 forks source link

Invalid Memory Issue With The Library #15

Closed karl8solutions closed 1 month ago

karl8solutions commented 1 month ago

Hello,

I loaded the library you have, and there seems to be some issue with the memory command. Do you know how to fix this?

This is a abbreviated copy/paste...

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Micro"

Using board 'micro' from platform in folder: C:(personal) Inc\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6

Using core 'arduino' from platform in folder: C:(personal) Inc\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...

Alternatives for LibLanc.h: [LibLanc-3.0.2@3.0.2]

ResolveLibrary(LibLanc.h)

Alternatives for memory: []

ResolveLibrary(memory)

-> candidates: []In file included from C:\Users(personal)\Documents\Arduino\libraries\LibLanc-3.0.2\src/LibLanc. from C:\Users(personal info for my computer)\Documents\Arduino\cameratodevicelanc\cameratodevicelanc.ino:1: C:\Users(personal info for my computer)\Documents\Arduino\libraries\LibLanc-3.0.2\src/App/Lanc.h:4:10: fatal error: memory: No such file or directory

include

      ^~~~~~~~

compilation terminated.

Using library LibLanc-3.0.2 at version 3.0.2 in folder:(personal info for my computer)

exit status 1

Error compiling for board Arduino Micro.

sensslen commented 1 month ago

Hi @karl8solutions, it seems you're experiencing an error compiling LibLanc where the standard c++ header #include <memory> is not found. My quick research shows that the header should actually be available. I also see that you're using an outdated arduino IDe for the compliation. Would you be able to switch to the new Arduino 2.0 IDE? As far as I know the project should compile there....

If above advise does not help, you can try https://docs.arduino.cc/libraries/arduinostl/. You will have to include #include <ArduinoSTL.h> before you include #include <LibLanc.h> as the standard arduino environment may lack some c++ standard types used in LibLanc

karl8solutions commented 1 month ago

Hello, thank you for the reply. I updated my IDE to 2.33 and it still will not compile. Below is the code I am trying to compile, do you see anything wrong with it?

include

define LANC_INPUT_PIN 2

define LANC_OUTPUT_PIN 1

Lanc lanc::Lanc lanc(LANC_INPUT_PIN, LANC_OUTPUT_PIN);

typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class

void setup() { lanc.begin(); Serial.begin(9600); }

void loop() { if (lanc.available()) { uint8_t command = lanc.readCommand(); Serial.print("Received command: "); Serial.println(command, HEX);

// Example: Respond to a record start/stop command
if (command == LibLanc::CommandFactory::recordStartStop()) {
  // Toggle recording state
  toggleRecording();
}

} }

void toggleRecording() { static bool isRecording = false; isRecording = !isRecording; if (isRecording) { Serial.println("Recording started"); // Add code to start recording } else { Serial.println("Recording stopped"); // Add code to stop recording } }

Karl Adair | Electronic Engineering Tech.

O: 321 804 8200 | C: 386 320 8629

@.**@.>

[8K Logo Square Small]


From: Simon Ensslen @.> Sent: Monday, October 14, 2024 3:57 AM To: sensslen/LibLanc @.> Cc: Karl Adair @.>; Mention @.> Subject: Re: [sensslen/LibLanc] Invalid Memory Issue With The Library (Issue #15)

Hi @karl8solutionshttps://github.com/karl8solutions, it seems you're experiencing an error compiling LibLanc where the standard c++ header #include is not found. My quick research shows that the header should actually be available. I also see that you're using an outdated arduino IDe for the compliation. Would you be able to switch to the new Arduino 2.0 IDE? As far as I know the project should compile there....

— Reply to this email directly, view it on GitHubhttps://github.com/sensslen/LibLanc/issues/15#issuecomment-2410348801, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APYHQQISKYKFOTRAAIIB5P3Z3N2PRAVCNFSM6AAAAABPZFCSDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJQGM2DQOBQGE. You are receiving this because you were mentioned.Message ID: @.***>

sensslen commented 1 month ago

Hello, thank you for the reply. I updated my IDE to 2.33 and it still will not compile. Below is the code I am trying to compile, do you see anything wrong with it? #include #define LANC_INPUT_PIN 2 #define LANC_OUTPUT_PIN 1 Lanc lanc::Lanc lanc(LANC_INPUT_PIN, LANC_OUTPUT_PIN); typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class void setup() { lanc.begin(); Serial.begin(9600); } void loop() { if (lanc.available()) { uint8_t command = lanc.readCommand(); Serial.print("Received command: "); Serial.println(command, HEX); // Example: Respond to a record start/stop command if (command == LibLanc::CommandFactory::recordStartStop()) { // Toggle recording state toggleRecording(); } } } void toggleRecording() { static bool isRecording = false; isRecording = !isRecording; if (isRecording) { Serial.println("Recording started"); // Add code to start recording } else { Serial.println("Recording stopped"); // Add code to stop recording } } Karl Adair | Electronic Engineering Tech. O: 321 804 8200 | C: 386 320 8629 @.**@.> [8K Logo Square Small] ____ From: Simon Ensslen @.> Sent: Monday, October 14, 2024 3:57 AM To: sensslen/LibLanc @.> Cc: Karl Adair @.>; Mention @.> Subject: Re: [sensslen/LibLanc] Invalid Memory Issue With The Library (Issue #15) Hi @karl8solutionshttps://github.com/karl8solutions, it seems you're experiencing an error compiling LibLanc where the standard c++ header #include is not found. My quick research shows that the header should actually be available. I also see that you're using an outdated arduino IDe for the compliation. Would you be able to switch to the new Arduino 2.0 IDE? As far as I know the project should compile there.... — Reply to this email directly, view it on GitHub<#15 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APYHQQISKYKFOTRAAIIB5P3Z3N2PRAVCNFSM6AAAAABPZFCSDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJQGM2DQOBQGE. You are receiving this because you were mentioned.Message ID: @.***>

There are various things that seem wrong here: typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class I believe is not valid c++ syntax. At least you should never redefine uint8_t...

Also, it seems you're trying to use LibLanc for something it is not ment to do. LibLanc is not capable of receiving Lanc commands. It's used to connect to a camera (or other Lanc masters). Please have a look at the examples.

Also you must call lanc.loop()....

The readme has the following example which should give you a good starting point:

#include <Commands/ZoomCommand.h>
#include <LibLanc.h>

#include <memory>

// LibLanc
// by Simon Ensslen <https://github.com/sensslen>
// This example illustrates the usage of the liblanc library in blocking mode

#define LANC_INPUT_PIN 2
#define LANC_OUTPUT_PIN 3
std::unique_ptr<LibLanc::App::Lanc> lanc;

void setup()
{
    LibLanc::LancBuilder lancBuilder;
    lancBuilder.UseTwoPinPhysicalLayer(LANC_INPUT_PIN, LANC_OUTPUT_PIN, LibLanc::Phy::OutputType::PushPull);
    lanc = lancBuilder.CreateBlocking();
    lanc->begin();
}

void loop()
{
    // get next command to execute (this should be something received from somewhere else - e.g. via serial)
    // call lanc.setCommand(LibLanc::CommandFactory::zoom(3));
    lanc->loop();
}
karl8solutions commented 1 month ago

I want this device to be the Lanc master. How could I alter your code to do that? I want to start/stop record, I do not care to receive any other information from the external video recorder.

Karl Adair | Electronic Engineering Tech.

O: 321 804 8200 | C: 386 320 8629

@.**@.>

[8K Logo Square Small]


From: Simon Ensslen @.> Sent: Monday, October 14, 2024 9:42 AM To: sensslen/LibLanc @.> Cc: Karl Adair @.>; Mention @.> Subject: Re: [sensslen/LibLanc] Invalid Memory Issue With The Library (Issue #15)

Hello, thank you for the reply. I updated my IDE to 2.33 and it still will not compile. Below is the code I am trying to compile, do you see anything wrong with it? #include #define LANC_INPUT_PIN 2 #define LANC_OUTPUT_PIN 1 Lanc lanc::Lanc lanc(LANC_INPUT_PIN, LANC_OUTPUT_PIN); typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class void setup() { lanc.begin(); Serial.begin(9600); } void loop() { if (lanc.available()) { uint8_t command = lanc.readCommand(); Serial.print("Received command: "); Serial.println(command, HEX); // Example: Respond to a record start/stop command if (command == LibLanc::CommandFactory::recordStartStop()) { // Toggle recording state toggleRecording(); } } } void toggleRecording() { static bool isRecording = false; isRecording = !isRecording; if (isRecording) { Serial.println("Recording started"); // Add code to start recording } else { Serial.println("Recording stopped"); // Add code to stop recording } } Karl Adair | Electronic Engineering Tech. O: 321 804 8200 | C: 386 320 8629 @.@.> [8K Logo Square Small] … ____ From: Simon Ensslen @.> Sent: Monday, October 14, 2024 3:57 AM To: sensslen/LibLanc @.> Cc: Karl Adair @.>; Mention @.> Subject: Re: [sensslen/LibLanc] Invalid Memory Issue With The Library (Issue #15https://github.com/sensslen/LibLanc/issues/15) Hi @karl8solutionshttps://github.com/karl8solutionshttps://github.com/karl8solutions, it seems you're experiencing an error compiling LibLanc where the standard c++ header #include is not found. My quick research shows that the header should actually be available. I also see that you're using an outdated arduino IDe for the compliation. Would you be able to switch to the new Arduino 2.0 IDE? As far as I know the project should compile there.... — Reply to this email directly, view it on GitHub<#15 (comment)https://github.com/sensslen/LibLanc/issues/15#issuecomment-2410348801>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APYHQQISKYKFOTRAAIIB5P3Z3N2PRAVCNFSM6AAAAABPZFCSDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJQGM2DQOBQGE. You are receiving this because you were mentioned.Message ID: @.***>

There are various things that seem wrong here: typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class I believe is not valid c++ syntax. At least you should never redefine uint8_t...

Also, it seems you're trying to use LibLanc for something it is not ment to do. LibLanc is not capable of receiving Lanc commands. It's used to connect to a camera (or other Lanc masters). Please have a look at the examples.

Also you must call lanc.loop()....

— Reply to this email directly, view it on GitHubhttps://github.com/sensslen/LibLanc/issues/15#issuecomment-2411310780, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APYHQQMNY3YDKDSUKJJJQJDZ3PC35AVCNFSM6AAAAABPZFCSDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJRGMYTANZYGA. You are receiving this because you were mentioned.Message ID: @.***>

sensslen commented 1 month ago

I want this device to be the Lanc master. How could I alter your code to do that? I want to start/stop record, I do not care to receive any other information from the external video recorder.

Karl Adair | Electronic Engineering Tech.

O: 321 804 8200 | C: 386 320 8629

@.**@.>

[8K Logo Square Small]


From: Simon Ensslen @.***>

Sent: Monday, October 14, 2024 9:42 AM

To: sensslen/LibLanc @.***>

Cc: Karl Adair @.>; Mention @.>

Subject: Re: [sensslen/LibLanc] Invalid Memory Issue With The Library (Issue #15)

Hello, thank you for the reply. I updated my IDE to 2.33 and it still will not compile. Below is the code I am trying to compile, do you see anything wrong with it? #include #define LANC_INPUT_PIN 2 #define LANC_OUTPUT_PIN 1 Lanc lanc::Lanc lanc(LANC_INPUT_PIN, LANC_OUTPUT_PIN); typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class void setup() { lanc.begin(); Serial.begin(9600); } void loop() { if (lanc.available()) { uint8_t command = lanc.readCommand(); Serial.print("Received command: "); Serial.println(command, HEX); // Example: Respond to a record start/stop command if (command == LibLanc::CommandFactory::recordStartStop()) { // Toggle recording state toggleRecording(); } } } void toggleRecording() { static bool isRecording = false; isRecording = !isRecording; if (isRecording) { Serial.println("Recording started"); // Add code to start recording } else { Serial.println("Recording stopped"); // Add code to stop recording } } Karl Adair | Electronic Engineering Tech. O: 321 804 8200 | C: 386 320 8629 @.@.> [8K Logo Square Small]

____ From: Simon Ensslen @.> Sent: Monday, October 14, 2024 3:57 AM To: sensslen/LibLanc @.> Cc: Karl Adair @.>; Mention @.> Subject: Re: [sensslen/LibLanc] Invalid Memory Issue With The Library (Issue #15https://github.com/sensslen/LibLanc/issues/15) Hi @karl8solutionshttps://github.com/karl8solutionshttps://github.com/karl8solutions, it seems you're experiencing an error compiling LibLanc where the standard c++ header #include is not found. My quick research shows that the header should actually be available. I also see that you're using an outdated arduino IDe for the compliation. Would you be able to switch to the new Arduino 2.0 IDE? As far as I know the project should compile there.... — Reply to this email directly, view it on GitHub<#15 (comment)https://github.com/sensslen/LibLanc/issues/15#issuecomment-2410348801>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APYHQQISKYKFOTRAAIIB5P3Z3N2PRAVCNFSM6AAAAABPZFCSDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJQGM2DQOBQGE. You are receiving this because you were mentioned.Message ID: @.***>

There are various things that seem wrong here:

typedef uint8_t(LANC_INPUT_PIN, LANC_OUTPUT_PIN); // Create an instance of the Lanc class I believe is not valid c++ syntax. At least you should never redefine uint8_t...

Also, it seems you're trying to use LibLanc for something it is not ment to do. LibLanc is not capable of receiving Lanc commands. It's used to connect to a camera (or other Lanc masters). Please have a look at the examples.

Also you must call lanc.loop()....

Reply to this email directly, view it on GitHubhttps://github.com/sensslen/LibLanc/issues/15#issuecomment-2411310780, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APYHQQMNY3YDKDSUKJJJQJDZ3PC35AVCNFSM6AAAAABPZFCSDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJRGMYTANZYGA.

You are receiving this because you were mentioned.Message ID: @.***>

You're better off starting from scratch than using this library. Master and client implementations are very different.