For DOS Protected Mode version of sensor core software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
2.6 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "dosdebug.h"
  2. //extern unsigned _heaplen = 54321U;
  3. #ifdef DEBUG_OUT_FILE
  4. static FILE * DEBUG_FD = NULL;
  5. #endif
  6. void debug( char *msg, ... ){
  7. //*
  8. int i = 0;
  9. struct time t;
  10. va_list valist;
  11. char Format[256];
  12. char Buffer[256];
  13. sprintf( Format, "\n%%02d:%%02d:%%02d.%%02d %%s" );
  14. gettime( &t );
  15. sprintf( Buffer, Format, t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund, msg );
  16. va_start( valist, msg );
  17. vsprintf( Format, Buffer, valist );
  18. va_end( valist );
  19. for( i = strlen( Format ); i < 70; i++ ) Format[i]='.';
  20. Format[i] = (char) 0;
  21. #ifdef DEBUG_OUT_FILE
  22. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  23. if( DEBUG_FD ){
  24. fprintf( DEBUG_FD, Format );
  25. fclose( DEBUG_FD );
  26. DEBUG_FD = NULL;
  27. };
  28. #else
  29. printf( Format );
  30. #endif
  31. //*/
  32. /*
  33. #ifdef DEBUG_OUT_FILE
  34. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  35. if( DEBUG_FD ){
  36. fprintf( DEBUG_FD, "%s\n", msg );
  37. fclose( DEBUG_FD );
  38. DEBUG_FD = NULL;
  39. };
  40. #else
  41. printf( "%s\n", msg );
  42. #endif
  43. */
  44. };
  45. void debugProcBegin( char *msg, ... ){
  46. //*
  47. int i = 0;
  48. struct time t;
  49. va_list valist;
  50. char Format[256];
  51. char Buffer[256];
  52. sprintf( Format, "\n%%02d:%%02d:%%02d.%%02d %%s" );
  53. int la = strlen( Format );
  54. gettime( &t );
  55. sprintf( Buffer, Format, t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund, msg );
  56. va_start( valist, msg );
  57. vsprintf( Format, Buffer, valist );
  58. va_end( valist );
  59. for( i = strlen( Format ); i < 70; i++ ) Format[i]='.';
  60. Format[i] = (char) 0;
  61. #ifdef DEBUG_OUT_FILE
  62. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  63. if( DEBUG_FD ){
  64. fprintf( DEBUG_FD, Format );
  65. fclose( DEBUG_FD );
  66. DEBUG_FD = NULL;
  67. };
  68. #else
  69. printf( Format );
  70. #endif
  71. //*/
  72. /*
  73. #ifdef DEBUG_OUT_FILE
  74. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  75. if( DEBUG_FD ){
  76. fprintf( DEBUG_FD, "%s\n", msg );
  77. fclose( DEBUG_FD );
  78. DEBUG_FD = NULL;
  79. };
  80. #else
  81. printf( "%s\n", msg );
  82. #endif
  83. */
  84. };
  85. void debugProcEnd( unsigned char z){
  86. //*
  87. if( z ) {
  88. #ifdef DEBUG_OUT_FILE
  89. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  90. if( DEBUG_FD ){
  91. fprintf( DEBUG_FD, "[OK]" );
  92. fclose( DEBUG_FD );
  93. DEBUG_FD = NULL;
  94. };
  95. #else
  96. printf( "[OK]" );
  97. #endif
  98. } else {
  99. #ifdef DEBUG_OUT_FILE
  100. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  101. if( DEBUG_FD ){
  102. fprintf( DEBUG_FD, "[ERROR]" );
  103. fclose( DEBUG_FD );
  104. DEBUG_FD = NULL;
  105. };
  106. #else
  107. printf( "[ERROR]" );
  108. #endif
  109. };
  110. //*/
  111. /*
  112. if( z ){
  113. #ifdef DEBUG_OUT_FILE
  114. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  115. if( DEBUG_FD ){
  116. fprintf( DEBUG_FD, "[OK]\n" );
  117. fclose( DEBUG_FD );
  118. DEBUG_FD = NULL;
  119. };
  120. #else
  121. printf( "[OK]\n" );
  122. #endif
  123. } else {
  124. #ifdef DEBUG_OUT_FILE
  125. DEBUG_FD = fopen( DEBUG_OUT_FILE ,"a+");
  126. if( DEBUG_FD ){
  127. fprintf( DEBUG_FD, "[ERROR]\n");
  128. fclose( DEBUG_FD );
  129. DEBUG_FD = NULL;
  130. };
  131. #else
  132. printf( "[ERROR]\n" );
  133. #endif
  134. };
  135. */
  136. };