purtroppo nn avevo il modem x provare e nemmeno il mio amico . mi sono messo li a litigare credendo che la porta funziona e basta . mi sono messo a provare mille cose e alla fine ho risolto . in pratica era un problema del programma ! vai a saperlo il perchè . lo abbiamo provato su una distro identica e a lui nn va a me si . in pratica il problema sta in queste righe ( su un timer ? magari se c'è qualche programmatore )
/* READ WIND SPEED AND DIRECTION */
sprintf(tempstring,"%.1f ",
wind_all(ws2300, config.wind_speed_conv_factor, &tempint, winddir));
strcat(logline, tempstring);
sprintf(tempstring,"%.1f %s ", winddir[0], directions[tempint]);
strcat(logline, tempstring);
nella funzione o quello che è wind_all
/********************************************************************
* wind_all
* Read wind speed, wind direction and last 5 wind directions
*
* Input: Handle to weatherstation
* wind_speed_conv_factor controlling convertion to other
* units than m/s
*
* Output: winddir_index
* Current wind direction expressed as ticks from North
* where North=0. Used to convert to direction string
* winddir
* Array of doubles containing current winddirection
* in winddir[0] and the last 5 in the following
* positions all given in degrees
*
* Returns: Wind speed (double) in the unit given in the loaded config
*
********************************************************************/
double wind_all(WEATHERSTATION ws2300,
double wind_speed_conv_factor,
int *winddir_index,
double *winddir)
{
unsigned char data[20];
unsigned char command[25]; //room for write data also
int i;
int address=0x527; //Windspeed and direction
int bytes=6;
for (i=0; i<MAXWINDRETRIES; i++)
{
if (read_safe(ws2300, address, bytes, data, command)!=bytes) //Wind
read_error_exit();
if ( (data[0]!=0x00) || //Invalid wind data
((data[1]==0xFF) && (((data[2]&0xF)==0)||( (data[2]&0xF)==1))) )
{
QUESTA LINEA SLEEPLONG l'ho commentata e ora l'output torna in 10 secondi , prima 3 minuti o +
sleep_long(10); //wait 10 seconds for new wind measurement
continue;
}
else
{
break;
}
}
//Calculate wind directions
*winddir_index = (data[2]>>4);
winddir[0] = (data[2]>>4)*22.5;
winddir[1] = (data[3]&0xF)*22.5;
winddir[2] = (data[3]>>4)*22.5;
winddir[3] = (data[4]&0xF)*22.5;
winddir[4] = (data[4]>>4)*22.5;
winddir[5] = (data[5]&0xF)*22.5;
//Calculate raw wind speed - convert from m/s to whatever
return ( (((data[2]&0xF)<<8)+(data[1]) ) / 10.0 * wind_speed_conv_factor);
}
su un altro file trovo
/* Platform dependent functions */
int read_device(WEATHERSTATION serdevice, unsigned char *buffer, int size);
int write_device(WEATHERSTATION serdevice, unsigned char *buffer, int size);
void sleep_short(int milliseconds);
void sleep_long(int seconds);
c'è una spiegazione valida ?
|