Changeset 10910 for firmware/FSC/src/parser.c
- Timestamp:
- 06/05/11 17:40:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FSC/src/parser.c
r10697 r10910 41 41 case 'g': // GET the voltage/current/humidity channels, which are enabled 42 42 once_told_you = false; 43 for ( U08 i=0; i<VOLTAGE_ CHANNELS/8; ++i ) {43 for ( U08 i=0; i<VOLTAGE_REGS; ++i ) { 44 44 adc_channels_ready[i]=0; 45 45 } … … 107 107 } 108 108 */ 109 /* 109 110 110 111 111 // this is the recent MSR parser … … 242 242 case 'G': // GET the Temperature channels, which are enabled 243 243 ad7719_values_printed = false; 244 for ( U08 i=0; i<RESISTANCE_CHANNELS/8; ++i ) {245 ad7719_channels_ready[i]=0;246 }247 break;244 reset_resistance_done(); 245 reset_resistance_values(); 246 break; 247 248 248 case 'g': // GET the voltage/current/humidity channels, which are enabled 249 249 adc_values_printed = false; 250 for ( U08 i=0; i<VOLTAGE_CHANNELS/8; ++i ) { 251 adc_channels_ready[i]=0; 252 } 250 reset_voltage_done(); 251 reset_voltage_values(); 253 252 break; 254 253 … … 264 263 ad7719_print_endless = false; 265 264 break; 265 266 case 's': 267 print_status(); 268 //print_adc_enable_status(true); 269 //usart_write_char('\n'); 270 271 //print_ad7719_enable_status(true); 272 //usart_write_char('\n'); 273 274 //usart_write_str((pU08)"time:"); 275 //usart_write_float((float)local_ms/1000 , 1,7); 276 //usart_write_str((pU08)" sec.\n"); 277 break; 266 278 267 268 case 's': 269 print_adc_enable_status(true); 270 usart_write_char('\n'); 271 272 print_ad7719_enable_status(true); 273 usart_write_char('\n'); 274 275 usart_write_str((pU08)"time:"); 276 usart_write_float((float)local_ms/1000 , 1,7); 277 usart_write_str((pU08)" sec.\n"); 278 break; 279 case 'S': 280 write_status_via_eth(); 281 break; 279 282 280 283 case '!': … … 306 309 } // END of MSR_parser(); 307 310 308 */ 311 309 312 310 313 /////////////////////////////////////////////////////////////////////////////////////// … … 342 345 case 's': // return *s*tatus information 343 346 // this might take a lot of time... about... 25us per byte .. --> less than 25ms 344 w5100_set_TX(FSCregister, FSC_REGISTER_LENGTH); 347 write_status_via_eth(); 348 //w5100_set_TX(FSCregister, FSC_REGISTER_LENGTH); 345 349 break; 346 350 … … 372 376 } 373 377 } 378 void reset_resistance_values(){ 379 for (U08 i=0; i < RESISTANCE_CHANNELS; i++){ 380 ad7719_values[i] = 0; 381 } 382 } 383 384 374 385 void reset_voltage_done(){ 375 for (U08 i=0; i < (VOLTAGE_ CHANNELS/8); i++){386 for (U08 i=0; i < (VOLTAGE_REGS); i++){ 376 387 adc_channels_ready[i] = 0; 377 388 } 378 389 } 390 void reset_voltage_values(){ 391 for (U08 i=0; i < VOLTAGE_CHANNELS; i++){ 392 adc_values[i] = 0; 393 } 394 } 395 379 396 void reset_done(){ 380 397 reset_resistance_done(); … … 387 404 w5100_set_TX(eth_write_buffer, 2); 388 405 } 406 407 void write_status_via_eth() { 408 // take care: ethernet write buffer is just 32 bytes long. 409 eth_write_str("status: "); eth_writeln_str(nc_U32_to_hex(status)); 410 // better switch off interrupts here: 411 // otherwise the numbers in time_sec and time_ms might get corrupt during output. 412 cli(); 413 eth_write_str("time_s: "); eth_writeln_str(nc_U32_to_str(time_sec, 10)); 414 eth_write_str("mili_s: "); eth_writeln_str(nc_U16_to_str(time_ms, 6)); 415 sei(); 416 417 eth_write_str("R_ref : "); eth_writeln_str(nc_U16_to_str(ref_resistor, 6)); 418 419 eth_writeln_str("VOLTAGES\n"); 420 eth_write_str("enable:"); 421 for (U08 i=0; i<4 ; i++){ 422 eth_write_str(nc_U08_to_bin(adc_enables[i])); 423 // need to tweak here in order to get some nice spaces... 424 eth_write_buffer[eth_write_index] = ' '; 425 eth_write_index++; 426 } 427 eth_writeln_str(nc_U08_to_bin(adc_enables[4])); 428 429 eth_write_str(" done:"); 430 for (U08 i=0; i<4 ; i++){ 431 eth_write_str(nc_U08_to_bin(adc_channels_ready[i])); 432 // need to tweak here in order to get some nice spaces... 433 eth_write_buffer[eth_write_index] = ' '; 434 eth_write_index++; 435 } 436 eth_writeln_str(nc_U08_to_bin(adc_channels_ready[4])); 437 438 eth_write_str("values:"); 439 for (U08 i=0; i<73 ; i++){ 440 eth_write_str(nc_U16_to_str(adc_values[i], 6) ); 441 // need to tweak here in order to get some nice spaces... 442 eth_write_buffer[eth_write_index] = ' '; 443 eth_write_index++; 444 } 445 eth_writeln_str(nc_U16_to_str(adc_values[73], 6) ); 446 447 eth_writeln_str("RESISTANCES\n"); 448 eth_write_str("enable:"); 449 for (U08 i=0; i<7 ; i++){ 450 eth_write_str(nc_U08_to_bin(ad7719_enables[i])); 451 // need to tweak here in order to get some nice spaces... 452 eth_write_buffer[eth_write_index] = ' '; 453 eth_write_index++; 454 } 455 eth_writeln_str(nc_U08_to_bin(ad7719_enables[7])); 456 457 eth_write_str(" done:"); 458 for (U08 i=0; i<7 ; i++){ 459 eth_write_str(nc_U08_to_bin(ad7719_channels_ready[i])); 460 // need to tweak here in order to get some nice spaces... 461 eth_write_buffer[eth_write_index] = ' '; 462 eth_write_index++; 463 } 464 eth_writeln_str(nc_U08_to_bin(ad7719_channels_ready[7])); 465 466 eth_write_str("values:"); 467 for (U08 i=0; i<63 ; i++){ 468 eth_write_str(nc_U32_to_str(ad7719_values[i], 10) ); 469 // need to tweak here in order to get some nice spaces... 470 eth_write_buffer[eth_write_index] = ' '; 471 eth_write_index++; 472 } 473 eth_writeln_str(nc_U32_to_str(ad7719_values[63], 10) ); 474 475 476 }
Note:
See TracChangeset
for help on using the changeset viewer.