sunwait
sunwait copied to clipboard
Sunwait in poll mode returns 512 or 768
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