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

One more Compile problem #2

Open
ispybadguys opened this issue Mar 4, 2022 · 5 comments
Open

One more Compile problem #2

ispybadguys opened this issue Mar 4, 2022 · 5 comments

Comments

@ispybadguys
Copy link

Thanks for the quick reply on my previous issue. I must also complement you on the excellent job you have done documenting this. I have one more issue that is probably a library issue. I get the following error:

'EEPROMWriteAnything' was not declared in this scope; did you mean 'EEPROM_writeAnything'?

Just prior to that error I get

In file included from /Users/Kurt/Documents/Arduino 2019/ESP8266_AscomSwitch/ESP8266_AscomSwitch.ino:211:
/Users/Kurt/Documents/Arduino 2019/libraries/ESP_Alpaca_common-master/ASCOMAPICommon_rest.h: In function 'void handleAPIversions()':
/Users/Kurt/Documents/Arduino 2019/libraries/ESP_Alpaca_common-master/ASCOMAPICommon_rest.h:373:38: error: request for member 'c_str' in 'InterfaceVersion', which is of non-class type 'const char*'
373 | values.add(atoi(InterfaceVersion.c_str()));
| ^~~~~
/Users/Kurt/Documents/Arduino 2019/libraries/ESP_Alpaca_common-master/ASCOMAPICommon_rest.h: In function 'void handleAPIconfiguredDevices()':
/Users/Kurt/Documents/Arduino 2019/libraries/ESP_Alpaca_common-master/ASCOMAPICommon_rest.h:399:29: error: 'INSTANCE_NUMBER' was not declared in this scope
399 | device["DeviceNumber"]= INSTANCE_NUMBER;

Thanks

Kurt

@skybadger
Copy link
Owner

Hmm, I am having a second conversation with RSTON on the instance number issue. George added this as a part of the work he updated and added as a #define constant, hence the caps, which I subsequently changed to a variable since there are reasons to reflect different instance numbers if you host multiple drivers.

The interfaceVersion is the same as RSTON issue ( private email) . This is something he has also come across and I don't understand why its not picking up the interfaceVersion to be found in Webrelay_common.h which is an integer so doesn't need the C_str() or atoi conversion.
I recommend making the change that means just pulls that ASCOMAPICommon_rest.h getInterfaceVersion just returns that integer while I have more of a look. I suspect there is a file in the release that is not up to date .

@ispybadguys
Copy link
Author

I found at line 28 of Webrelat_common.h "static const char* PROGMEM InterfaceVersion = "2";" but I don't find getInterfaceVersion. I am a little obtuse because I am not exactly following you. Can you elaborate a little.

Also do you have any thought on the error 'EEPROMWriteAnything' was not declared in this scope; did you mean 'EEPROM_writeAnything'? Do I have the wrong library somehow?

Thanks
Kurt

@skybadger
Copy link
Owner

Sorry - been looking at this- I dont understand why the library and my source code are different.
I'll push an update and tag

@skybadger
Copy link
Owner

The InterfaceVersion string is defined in WebRelay_Common.h as a driver-specific property
static const char* PROGMEM InterfaceVersion = "2";

which is included by ASCOMAPICommon_rest.h which provides the generic driver information functions and used in handleInterfaceVersionGet which is a webhandler function

void handleInterfaceVersionGet(void)
{
String message;
//Dont care about client IDs for read-only data
uint32_t clientID = (uint32_t)server.arg("ClientID").toInt();
uint32_t clientTransID = (uint32_t)server.arg("ClientTransactionID").toInt();

DynamicJsonBuffer jsonBuff(256);
JsonObject& root = jsonBuff.createObject();
jsonResponseBuilder( root, clientID, clientTransID, ++serverTransID, F("InterfaceVersion"), Success, "" );    
root["Value"]= String( InterfaceVersion); //From PROGMEM    
root.printTo(message);

#ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.println( message );
#endif

server.send(200, F("application/json"), message);
return ;

}
<<<
The note //;from PROGMEM is a reminder that the string is defined in PROGMEM and so by calling String() on the variable, it uses F() internally to load which is PROGMEM safe.

@skybadger
Copy link
Owner

skybadger commented Mar 15, 2022

I found the problem - I seemed to be updating an obscure branch of the ESP_Alpaca_common code rather than the master.
I created a new folder, pulled from remote the current master, copied in the up to date code and pushed to remote as master.
I have since use the new folder on my local laptop to re-compile and it looks good.
Can you re-try with a recent pull please.

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