aster94 / GoProControl

Arduino library to interface with GoPro cameras
GNU General Public License v3.0
121 stars 21 forks source link

Compilation error: 'HERO3' was not declared in this scope #46

Open emccorm2 opened 1 year ago

emccorm2 commented 1 year ago

Hello,

First off thank you for taking the time to create this library. I am though running into an issue with Verifying the code. So I went back to just the basic library and tried the example (GoProControl.ino) and get the same error "Compilation error: 'HERO3' was not declared in this scope" I've tried changing #define GOPRO_SSID "HERO3" in secrets.h but that didn't work. What am I missing it's probably something simple.

aster94 commented 1 year ago

Hello,

Show your code in proper formattation

Il Ven 4 Ago 2023, 14:51 emccorm2 @.***> ha scritto:

Hello,

First off thank you for taking the time to create this library. I am though running into an issue with Verifying the code. So I went back to just the basic library and tried the example (GoProControl.ino) and get the same error "Compilation error: 'HERO3' was not declared in this scope" I've tried changing #define GOPRO_SSID "HERO3" in secrets.h but that didn't work. What am I missing it's probably something simple.

— Reply to this email directly, view it on GitHub https://github.com/aster94/GoProControl/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUBTW7RASK76VHWRI5T7DXTTV6ZANCNFSM6AAAAAA3EFL3MI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

emccorm2 commented 1 year ago

Please see below

Error

GoProControl.ino

include

include "Secrets.h"

/ Control your GoPro with the Serial Monitor edit the file Secrets.h with your camera netword name and password CAMERA could be: HERO3, HERO4, HERO5, HERO6, HERO7, FUSION, HERO8, MAX /

define CAMERA HERO3 // Change here for your camera

GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);

void setup() { gp.enableDebug(&Serial); }

void loop() { char in = 0; if (Serial.available() > 0) { in = Serial.read(); }

switch (in) { default: break;

// Connect case 'b': gp.begin(); break;

case 'c': Serial.print("Connected: "); Serial.println(gp.isConnected() == true ? "Yes" : "No"); break;

case 'p': gp.confirmPairing(); break;

case 's':

if (CAMERA == HERO3)
{
  char * statusChar;
  statusChar = gp.getStatus();
  Serial.println("Status :");
  for(int i = 0; i < 56; i++)
  {
    Serial.print(statusChar[i], HEX);Serial.print(" ");
  }
  Serial.println("");
  Serial.println("End Status.");
  if (statusChar[0] == 0x00){Serial.println("camera ON");}
  else{Serial.println("camera OFF");}
  free(statusChar); // Don't forget to free memory
}

else
{
  char * statusChar;
  statusChar = gp.getStatus();
  Serial.println("Status :");
  Serial.println(statusChar);
  free(statusChar); // Don't forget to free memory
}

break;

case 'm': // DO NOT USE WHEN CAMERA IS OFF, IT FREEZE ESP char* medialist; medialist = gp.getMediaList(); Serial.println("Media List:"); Serial.println(medialist); free(medialist); // Don't forget to free memory break;

// Turn on and off case 'T': gp.turnOn(); break;

case 't': gp.turnOff(); break;

// Take a picture of start a video case 'A': gp.shoot(); break;

// Stop the video case 'S': gp.stopShoot(); break;

// Check if it is recording case 'r': Serial.print("Recording: "); Serial.println(gp.isRecording() == true ? "Yes" : "No"); break;

// Set modes case 'V': gp.setMode(VIDEO_MODE); break;

case 'P': gp.setMode(PHOTO_MODE); break;

case 'M': gp.setMode(MULTISHOT_MODE); break;

// Change the orientation case 'U': gp.setOrientation(ORIENTATION_UP); break;

case 'D': gp.setOrientation(ORIENTATION_DOWN); break;

// Change other parameters case 'f': gp.setVideoFov(MEDIUM_FOV); break;

case 'F': gp.setFrameRate(FR_120); break;

case 'R': gp.setVideoResolution(VR_1080p); break;

case 'h': gp.setPhotoResolution(PR_12MP_WIDE); break;

case 'L': gp.setTimeLapseInterval(60); break;

// Localize the camera case 'O': gp.localizationOn(); break;

case 'o': gp.localizationOff(); break;

// Delete some files, be carefull! case 'l': gp.deleteLast(); break;

case 'g': gp.deleteAll(); break;

// Print useful data case 'd': gp.printStatus(); break;

// Close the connection case 'X': gp.end(); break; } gp.keepAlive(); // not needed on HERO3 }

Secrets.h

ifndef SECRETS_H

define SECRETS_H

// Replace the following:

define GOPRO_SSID "HERO3"

define GOPRO_PASS "2Hx-kzr-Gfn"

endif

emccorm2 commented 1 year ago

If I change line 10 to #define CAMERA "HERO3" // Change here for your camera With ""

I then get error Compilation error: invalid conversion from 'const char*' to 'uint8_t' {aka 'unsigned char'} [-fpermissive]

aster94 commented 1 year ago

You aren't the first one with this error, it's a problem of how Arduino manage the includes, I think, try

include "GoProControl.h"

Il Ven 4 Ago 2023, 19:05 emccorm2 @.***> ha scritto:

Please see below

Error

GoProControl.ino

include

include "Secrets.h"

/ Control your GoPro with the Serial Monitor edit the file Secrets.h with your camera netword name and password CAMERA could be: HERO3, HERO4, HERO5, HERO6, HERO7, FUSION, HERO8, MAX /

define CAMERA HERO3 // Change here for your camera

GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);

void setup() { gp.enableDebug(&Serial); }

void loop() { char in = 0; if (Serial.available() > 0) { in = Serial.read(); }

switch (in) { default: break;

// Connect case 'b': gp.begin(); break;

case 'c': Serial.print("Connected: "); Serial.println(gp.isConnected() == true ? "Yes" : "No"); break;

case 'p': gp.confirmPairing(); break;

case 's':

if (CAMERA == HERO3) { char * statusChar; statusChar = gp.getStatus(); Serial.println("Status :"); for(int i = 0; i < 56; i++) { Serial.print(statusChar[i], HEX);Serial.print(" "); } Serial.println(""); Serial.println("End Status."); if (statusChar[0] == 0x00){Serial.println("camera ON");} else{Serial.println("camera OFF");} free(statusChar); // Don't forget to free memory }

else { char * statusChar; statusChar = gp.getStatus(); Serial.println("Status :"); Serial.println(statusChar); free(statusChar); // Don't forget to free memory }

break;

case 'm': // DO NOT USE WHEN CAMERA IS OFF, IT FREEZE ESP char* medialist; medialist = gp.getMediaList(); Serial.println("Media List:"); Serial.println(medialist); free(medialist); // Don't forget to free memory break;

// Turn on and off case 'T': gp.turnOn(); break;

case 't': gp.turnOff(); break;

// Take a picture of start a video case 'A': gp.shoot(); break;

// Stop the video case 'S': gp.stopShoot(); break;

// Check if it is recording case 'r': Serial.print("Recording: "); Serial.println(gp.isRecording() == true ? "Yes" : "No"); break;

// Set modes case 'V': gp.setMode(VIDEO_MODE); break;

case 'P': gp.setMode(PHOTO_MODE); break;

case 'M': gp.setMode(MULTISHOT_MODE); break;

// Change the orientation case 'U': gp.setOrientation(ORIENTATION_UP); break;

case 'D': gp.setOrientation(ORIENTATION_DOWN); break;

// Change other parameters case 'f': gp.setVideoFov(MEDIUM_FOV); break;

case 'F': gp.setFrameRate(FR_120); break;

case 'R': gp.setVideoResolution(VR_1080p); break;

case 'h': gp.setPhotoResolution(PR_12MP_WIDE); break;

case 'L': gp.setTimeLapseInterval(60); break;

// Localize the camera case 'O': gp.localizationOn(); break;

case 'o': gp.localizationOff(); break;

// Delete some files, be carefull! case 'l': gp.deleteLast(); break;

case 'g': gp.deleteAll(); break;

// Print useful data case 'd': gp.printStatus(); break;

// Close the connection case 'X': gp.end(); break; } gp.keepAlive(); // not needed on HERO3 }

Secrets.h

ifndef SECRETS_H

define SECRETS_H

// Replace the following:

define GOPRO_SSID "HERO3"

define GOPRO_PASS "2Hx-kzr-Gfn"

endif

— Reply to this email directly, view it on GitHub https://github.com/aster94/GoProControl/issues/46#issuecomment-1665930285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUBTTAJQJPKSBIB4V7YYTXTUTWZANCNFSM6AAAAAA3EFL3MI . You are receiving this because you commented.Message ID: @.***>

emccorm2 commented 1 year ago

Same Error Code Compilation error: invalid conversion from 'const char*' to 'uint8_t' {aka 'unsigned char'} [-fpermissive]

Highlights line 12 GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);

Also Highlights lines: 48 if (CAMERA == HERO3) 110 gp.setMode(VIDEO_MODE); 114 gp.setMode(PHOTO_MODE); 118 gp.setMode(MULTISHOT_MODE); 123 gp.setOrientation(ORIENTATION_UP); 127 gp.setOrientation(ORIENTATION_DOWN); 132 gp.setVideoFov(MEDIUM_FOV); 136 gp.setVideoFov(MEDIUM_FOV); 140 gp.setVideoResolution(VR_1080p); 144 gp.setPhotoResolution(PR_12MP_WIDE);

Do I need to adjust anything in GoProConrol.h or Settings.h ?

emccorm2 commented 1 year ago

Changing in GoProControl.h From

include

include

to

include "Arduino.h"

include "Settings.h"

Unhighlighted lines 110 through 144 that were in error so maybe we are on to something.