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

Sunwait in poll mode returns 512 or 768 #19

Open
t-ara-fan opened this issue Jan 2, 2021 · 0 comments
Open

Sunwait in poll mode returns 512 or 768 #19

t-ara-fan opened this issue Jan 2, 2021 · 0 comments

Comments

@t-ara-fan
Copy link

t-ara-fan commented Jan 2, 2021

First, sunwait is a very handy program and thanks for all your work.

I am running sunwait on a Raspberry Pi, using C/C++ code developed with the Code::Blocks IDE.

I installed sunwait using snap as described here https://snapcraft.io/install/sunwait/raspbian. The version I got is "Sunwait for Windows. Version 0.800000 (IFC)." A little odd that is says "Windows".

I use the system() command to run sunwait with an appropriate command string

#define TEMP_STR_LENGTH 15
char    latitudeStr[TEMP_STR_LENGTH];
char    longitudeStr[TEMP_STR_LENGTH];
int     sunAngle;
#define CMD_STR_LEN 100
#define DAY_RETURN_CODE 512  // should be 2
#define NIGHT_RETURN_CODE 768 // should be 3

char commandString[CMD_STR_LEN];
int  systemResult;

sprintf(latitudeStr,"43.68608N");
sprintf(longitudeStr,"87.95198W");
sunAngle = -6;
sprintf(commandString,"sunwait %s %s poll",latitudeStr,longitudeStr);
systemResult = system(commandString);
printf("Resultcode is: %d\n",systemResult);

The command that is executed is

  sunwait 43.68608N 87.95198W poll

The return codes for DAY and NIGHT are 512 and 768, not 2 and 3 as described in the documentation. So the 2 and 3 are in the 2nd least significant byte of the result.

Am I doing something wrong? Or is it that the snap installer sort of compiles for Windows and that has different return codes than expected in Linux?

TIA

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

1 participant