Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emccorm2 opened this issue Aug 4, 2023 · 6 comments
Open

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

emccorm2 opened this issue Aug 4, 2023 · 6 comments

Comments

@emccorm2
Copy link

emccorm2 commented Aug 4, 2023

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
Copy link
Owner

aster94 commented Aug 4, 2023 via email

@emccorm2
Copy link
Author

emccorm2 commented Aug 4, 2023

Please see below

Error

GoProControl.ino

#include <GoProControl.h>
#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
Copy link
Author

emccorm2 commented Aug 4, 2023

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
Copy link
Owner

aster94 commented Aug 4, 2023 via email

@emccorm2
Copy link
Author

emccorm2 commented Aug 4, 2023

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
Copy link
Author

emccorm2 commented Aug 4, 2023

Changing in GoProControl.h
From
#include <Arduino.h>
#include <Settings.h>
to
#include "Arduino.h"
#include "Settings.h"

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants