pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


Quantron non-working filter optimisation, needs more work
Posted by Anonymous on Tue 29th Oct 2019 13:20
raw | new post

  1. diff --git a/ptxdist/local_src/ecu01-codesys/io_driver/ecu01compcap.cpp b/ptxdist/local_src/ecu01-codesys/io_driver/ecu01compcap.cpp
  2. index 552e8c0..6391612 100644
  3. --- a/ptxdist/local_src/ecu01-codesys/io_driver/ecu01compcap.cpp
  4. +++ b/ptxdist/local_src/ecu01-codesys/io_driver/ecu01compcap.cpp
  5. @@ -133,10 +133,15 @@ void Ecu01CompCap::cycle()
  6.     _refError = ioc.RefError;
  7.  
  8.     _isrTolerCnt = ioc.IsrTolerCnt;
  9. +#if 1
  10. +   _isrMaxDelay = (ioc.IsrMaxDelay*100L)/665;
  11. +   _isrAvgDelay = (ioc.IsrAvgDelay*100L)/665;
  12. +   _isrDelayCov = (ioc.IsrDelayCov*100L)/665;
  13. +#else
  14.     _isrMaxDelay = ioc.IsrMaxDelay;
  15.     _isrAvgDelay = ioc.IsrAvgDelay;
  16.     _isrDelayCov = ioc.IsrDelayCov;
  17. -
  18. +#endif
  19.  }
  20.  
  21.  
  22. diff --git a/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c b/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c
  23. index 5edb6d2..34297a5 100644
  24. --- a/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c
  25. +++ b/ptxdist/local_src/ecu01-comp-cap/mmc_imp.c
  26. @@ -90,35 +90,30 @@ int GetPhaseShift(const unsigned int * restrict ref, const unsigned int * restri
  27.  
  28.         halfperiod = periode / 2;
  29.  
  30. -       /* loop i over a maximum of 32 ref values. */
  31. +       /* loop i over a maximum of 32 shift values. */
  32.  
  33.         for (i=0, j=0 ; i<size ; i++) {
  34. -               /*
  35. -                * loop j over 32 shift values. This loop resumes for the next
  36. -                * ref were the previous pair of values was found
  37. -                */
  38.  
  39. -
  40. -/*
  41. - * In *theory* we should count from the last value of |j|, but somehow
  42. - * this does not work. We need to re-investigate this later.
  43. - */
  44. -#ifdef DOES_NOT_WORK_YET
  45. +               /* loop j over a maximum of 32 ref values... */
  46.                 for ( ; j<size ; j++) {
  47. -#else
  48. -               for (j=0 ; j<size ; j++) {
  49. -#endif
  50. -                       diff = shift[j] - ref[i];     /* calculate difference between shift and ref */
  51. +
  52. +                       diff = shift[i] - ref[j];       /* calculate difference between shift and ref */
  53.  
  54.                         /*
  55.                          * shift must be greater than ref to be a valid pair
  56.                          * and the difference must be less than the mean value of the ref period
  57.                          */
  58.  
  59. -                       if ((diff >= 0) && (diff < halfperiod)) {
  60. -                               /* valid pair found */
  61. -                               sum += diff;
  62. -                               cnt++;
  63. +                       if (diff >= 0) {
  64. +                               if (diff < halfperiod) {
  65. +                                       /* valid pair found */
  66. +                                       sum += diff;
  67. +                                       cnt++;
  68. +                                       // ?? j++;
  69. +                               } else {
  70. +                                       /* valid pair cannot be found for this i */
  71. +                               }
  72. +                              
  73.                                 break; /* exit loop -> next i */
  74.                         }
  75.                 } /* end for j */

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at