Concept code which launches two threads, one of which implements a Modbus Tunnel protocol to talk with an ISEM, the other which launches a Modbus RTU protocol to talk to a CPUM (most of the Modbus code has been removed prior to publishing.) A canned AC and DC spectra is provided to display wave forms on start-up however the project normally polls for spectra from the ISEM and then plots is (that functionality has been removed prior to publishing.)
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI mbed-os BSP_DISCO_F429ZI
Plot of the initial start-up canned AC and DC spectra.
Revision 2:346119b3db6c, committed 2019-05-31
- Comitter:
- Damotclese
- Date:
- Fri May 31 22:43:55 2019 +0000
- Parent:
- 1:01394e5db95b
- Commit message:
- Final concept code update, no further updates are expected;
Changed in this revision
NextGen-Exerciser-Main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/NextGen-Exerciser-Main.cpp Thu May 30 18:24:08 2019 +0000 +++ b/NextGen-Exerciser-Main.cpp Fri May 31 22:43:55 2019 +0000 @@ -184,11 +184,6 @@ // We will be using the LCD so instantiate an object locally static LCD_DISCO_F429ZI st_lcd; - // When searching for the intersection of AC and DC curves, we store the values here - static uint16_t u16_firstIntersectionHeight; - static uint16_t u16_secondIntersectionHeight; - - // ---------------------------------------------------------------------- // MainProcessDecimatedSpectrum() // @@ -355,93 +350,6 @@ } // ---------------------------------------------------------------------- -// MainFindACandDCintersections() -// -// This function attempts to locate the intersections where the AC and -// DC spectra curve meets. It locates the last intersection point -// encountered sweeping from left to right across the spectra, and for -// the second intersection point it locates the first intersection -// point. -// -// In this way we find the two locations at LCT_HEIGHT which indicates -// the surface area volume arena of the water peak, bounded by the AC -// curve to the top of the peak, and the DC curve at the bottom of -// the curve. -// -// ---------------------------------------------------------------------- -static void MainFindACandDCintersections(void) -{ - uint16_t u16_searchLoop = 0; - bool b_atFirstIntersection = false; - uint16_t u16_possibleFirst = 0; - uint16_t u16_areaACMin = 0; - uint16_t u16_areaACMax = 0; -#if 0 - uint16_t u16_areaDCMin = 0; - uint16_t u16_areaDCMax = 0; -#endif - - // Go through the 256 sample within both the AC and the DC - // spectra and first locate the first insersection point and - // then the second intersection point - for (u16_searchLoop = 0; u16_searchLoop < 256; u16_searchLoop++) - { - // Make sure that what we're looking at can be generally examined - if ((int)f_decimatedACSpectrum[u16_searchLoop] > 10 && - (int)f_decimatedDCSpectrum[u16_searchLoop] > 10) - { - // Each point on the plot is examined to see if the point is - // plus or minus 5 pixels to determine if they intersect. - u16_areaACMin = (int)f_decimatedACSpectrum[u16_searchLoop] - 5; - u16_areaACMax = (int)f_decimatedACSpectrum[u16_searchLoop] + 5; -#if 0 - u16_areaDCMin = (int)f_decimatedDCSpectrum[u16_searchLoop] - 5; - u16_areaDCMax = (int)f_decimatedDCSpectrum[u16_searchLoop] + 5; -#endif - - // Do these two points intersect? - if ((int)f_decimatedDCSpectrum[u16_searchLoop] >= u16_areaACMin && - (int)f_decimatedDCSpectrum[u16_searchLoop] <= u16_areaACMax) - { - // Do we have the first intersection already? - if (0 != u16_firstIntersectionHeight) - { - // We have the first intersection so this is the second - u16_secondIntersectionHeight = u16_searchLoop; - - // We have found both intersections so we are done - break; - } - else - { - // We are still searching for the first intersection - // so because we intersect here, note that we found it - b_atFirstIntersection = true; - - // Record the point at which the first intersected - u16_possibleFirst = u16_searchLoop; - } - } - else - { - // These two points do not intersect. - // Did we already find the first intersection point? - if (true == b_atFirstIntersection) - { - // We found the intersection point and then left the area where - // it intersected, so the last possible intersection point is - // the first area of intersection - u16_firstIntersectionHeight = u16_possibleFirst; - - // Since we have the first intersectiopn point located - b_atFirstIntersection = false; - } - } - } - } -} - -// ---------------------------------------------------------------------- // MainInit() // // This function will: @@ -452,12 +360,6 @@ // ---------------------------------------------------------------------- static void MainInit(void) { - uint8_t ach_intersectionString[31] = { 0 }; - - // Initialize the module's locall-held data - u16_firstIntersectionHeight = 0; - u16_secondIntersectionHeight = 0; - // Bring the LCD up and set its various colors st_lcd.Clear(LCD_COLOR_BLACK); st_lcd.SetBackColor(LCD_COLOR_BLACK); @@ -466,16 +368,6 @@ // Process the decimated spectrum and then plot it MainProcessDecimatedSpectrum(); MainPlotFinalSpectrum(); - - // Search the AC and DC plots for where they intersect - MainFindACandDCintersections(); - - (void)sprintf((char *)ach_intersectionString, - "Intersections %d and %d", - u16_firstIntersectionHeight, - u16_secondIntersectionHeight); - - st_lcd.DisplayStringAt(0, LINE(1), (uint8_t *)ach_intersectionString, LEFT_MODE); } // ----------------------------------------------------------------------