FILE* fp_json=fopen("stat.json","w");
fprintf(fp_json,"{ \"stats\": \n {");
fprintf(fp_json,"\"speed\": %d, \"noncerate\": %.3f, \"noncerateperchip\":%.3f, \"hashrate\":%.3f, \"good\":%d, \"errors\":%d, \"spi-errors\":%d, \"miso-errors\":%d, \"jobs\":%d, \"record\":%.3f\n",
speed,nr,(nr/chips),hr,nrate,error,espi,miso,job-last,record);
fprintf(fp_json,",\"boards\": [");
int firstboard = 0;
for(b=0;b if(b_speed[b]){
if (firstboard > 0)
fprintf(fp_json,",");
fprintf(fp_json,"\n{ ");
fprintf(fp_json,"\"slot\": \"%c\", \"speed\": %d, \"noncerate\":%.3f, \"hashrate\": %.3f, \"good\": %d, \"errors\": %d, \"spi-errors\": %d, \"miso-errors\":%d",board[b],b_speed[b],
(double)0xFFFFFFFF/1000000000.0*(double)b_nrate[b]/(double)wait,
(double)0xFFFFFFFF/1000000000.0*(double)b_hrate[b]/(double)wait*(double)756/(double)1024,
b_nrate[b],b_error[b],b_espi[b],b_miso[b]);
fprintf(fp_json," }\n");
firstboard = 1;
}
}
fprintf(fp_json,"\n ]");
fprintf(fp_json,"\n } }");
fclose(fp_json);
we just put out .... some more data in the stat.json which we then ... use for the web gui ... and done ...
... no magic ... stick needed here ...
... we need to decide what ... data we want to be displayed ... what do we need ...