diff -upNr ../Build-f/orig-src-2.15/commif_t.cpp src/commif_t.cpp --- ../Build-f/orig-src-2.15/commif_t.cpp 2011-03-09 21:05:40.000000000 +0100 +++ src/commif_t.cpp 2011-03-23 20:44:38.000000000 +0100 @@ -3644,6 +3644,7 @@ void CommIF::SCREENSHOT(unsigned char ma (void)putchar(marker); //Send start-of-transfer marker (void)putchar(0xFF); //Send start-of-transfer marker (void)putchar(0); //Send dumptye 0 Color + (void)putchar(1); //Send interface version for (y = 0; y < 480; y++) @@ -3678,6 +3679,138 @@ void CommIF::SCREENSHOT(unsigned char ma } +/* + * Why do we need this? + * Well, using puts() and printf() intermittently + * with putchar() results in garbled output, + * since they seem to use different buffers + * and don't flush them in the order we expect. + */ +void outstr(char *p) +{ + + while (*p != '\0') { + (void)putchar(*p); + p++; + } +} + +void outuint16(int x) +{ + + (void)putchar(x / 256); + (void)putchar(x % 256); +} + +/* + * Dump measurement data + * + * Output as follows: + * marker 0xff 0x04 [version] + * [type] [mode] [n] + * (where type 'Q' (Quick Meas), 'C' (Cursor), or '0' (no measurements); + * and mode 'X' (XY-Mode), 'F' (FFT), or 'N' (normal)) + * + * followed by n measurement spots, each: + * [full_string_as_on_dso] 0x01 + * [measurement_description_string] 0x01 + * [4 bytes of numerical data] + * [dimension_string] 0x01 + * [unit_string] 0x01 + * 0x00 + */ +void CommIF::DUMPMEAS(unsigned char marker) +{ + char *p; + int i, n; + + #define OUT(x) { \ + outstr(x.Read_Text()); \ + (void)putchar(0x01); \ + outstr(x.Read_PreText()); \ + (void)putchar(0x01); \ + outuint16(x.Read_IntBDot()+32768); \ + outuint16(x.Read_IntADot()); \ + outstr(x.Read_DimensionUnit()); \ + (void)putchar(0x01); \ + outstr(x.Read_Unit()); \ + (void)putchar(0x01); \ + } + #define ZERO() (void)putchar(0x00); + + (void)putchar('\n'); + (void)putchar(marker); + (void)putchar(0xFF); + (void)putchar(0x04); + (void)putchar(0x01); /* format version */ + + if (QM_Enabled) { + (void)putchar('Q'); + if (XY_Mode) + (void)putchar('X'); + else if (FFT_Mode != FFT_OFF) + (void)putchar('F'); + else // normal mode + (void)putchar('N'); + + n = 0; + for (i = 0; i < 3; i++) + if (QM_Type[i] > 0) + n++; + (void)putchar(n); + + if (QM_Type[0] > 0) + OUT(QM_Slot1); + ZERO(); + if (QM_Type[1] > 0) + OUT(QM_Slot2); + ZERO(); + if (QM_Type[2] > 0) + OUT(QM_Slot3); + ZERO(); + } else if (Cursor_Enabled && CRS_Delta) { + (void)putchar('C'); + if (XY_Mode) + { + (void)putchar('X'); + (void)putchar(0x02); + + OUT(Cursor_Delta_XY_X); + ZERO(); + OUT(Cursor_Delta_Y); + ZERO();; + } else if (FFT_Mode != FFT_OFF) { + (void)putchar('F'); + (void)putchar(0x03); + + OUT(FFT_Cursor_Delta_X); + ZERO(); + OUT(FFT_Cursor_Delta_1X); + ZERO(); + OUT(FFT_Cursor_Delta_Y); + ZERO(); + } else { + /* normal mode */ + (void)putchar('N'); + (void)putchar(0x03); + + OUT(Cursor_Delta_X); + ZERO(); + OUT(Cursor_Delta_1X); + ZERO(); + OUT(Cursor_Delta_Y); + ZERO(); + } + } else { + /* neither Cursor nor Quick Measure active */ + (void)putchar('0'); + (void)putchar(' '); + (void)putchar(0x00); + } + + (void)putchar('\n'); +} + //########################################################################################################################################################## // BF csv function for transmission of raw data // improved and extended by niklas (nevm) @@ -3691,9 +3824,9 @@ void CommIF::DUMPCSV(unsigned char marke if(marker == 'A') (void)putchar(3); //Send dumptye 3 (ASCII) else - (void)putchar(2); //Send dumptye 2 (CSV) -> 3 is ASCII but also triggered by marker = 'A' + (void)putchar(2); //Send dumptye 2 (CSV) - putchar(40); // parameter header size + putchar(42); // parameter header size // send actual DSO parameters putchar((char)NumberOfChannels); // 2 or 4 channels @@ -3728,7 +3861,7 @@ void CommIF::DUMPCSV(unsigned char marke putchar(RealTimebase); // real timebase for sample rate - #define OUTUINT16(x) { putchar(((int)(x))/256); putchar(((int)(x))%256); } + #define OUTUINT16(x) outuint16((int)(x)); OUTUINT16(Virtual_ZeroLevelCH1 + 1000); // virtual zero level ch1-4 as uint16 OUTUINT16(Virtual_ZeroLevelCH2 + 1000); // we add 1000 to make sure we're using @@ -3740,9 +3873,10 @@ void CommIF::DUMPCSV(unsigned char marke OUTUINT16(ScaleFactor[Selected_Voltage_CH3][GainIdx]*1000); OUTUINT16(ScaleFactor[Selected_Voltage_CH4][GainIdx]*1000); -// int Trig_Pos_Mem -> pre trigger memory index -// float PreTrigger -> pre trigger value - + OUTUINT16(Trig_Pos_Mem); // pre trigger memory index + + putchar(0x01); // header version, always _last_ + // send trace data for (idx = 0; idx < ((RealTimebase < 9) ? 16384 : 4096); idx++) // 16kSa vs. 4kSa. timebases { @@ -3752,8 +3886,7 @@ void CommIF::DUMPCSV(unsigned char marke if (Channel_4_Active) putchar(SIGNAL4[idx]); } - - rle_enc(0,2); + putchar('\n'); } //########################################################################################################################################################## @@ -4222,19 +4355,24 @@ int CommIF::handleInChar(unsigned char UART_NewData = 0; //reset UART ISR flag if (UartRxGuiCmd) { if (debug) printf("handleInChar(%.2X), UartRxGuiCmd: %d\n\r",c,UartRxGuiCmd); - switch(UartRxGuiCmd) { //handle 2Byte command for screenshot-App. + switch(UartRxGuiCmd) { + /* + * Handle 2 byte remote control command sequence + * + * 1, 2, 3, 4: W2000A Screenshot + * 5, 6, 7, (8): UC/Vinculum + */ case 1: - CommIF::SCREENSHOT('S'); // -> BF version in OS-compatibility mode + CommIF::SCREENSHOT('S'); break; case 2: - CommIF::SCREENSHOT_BW(); // black and white + CommIF::SCREENSHOT_BW(); break; case 3: - CommIF::DUMPCSV('S'); // save to CSV in OS-compatibility mode - + CommIF::DUMPCSV('S'); break; - case 4: - RS232_Data_Requested=1; + case 4: + CommIF::DUMPMEAS('S'); break; case 5: CommIF::UC_SCREENSHOT(); // -> UC version diff -upNr ../Build-f/orig-src-2.15/commif_t.h src/commif_t.h --- ../Build-f/orig-src-2.15/commif_t.h 2011-02-24 17:43:00.000000000 +0100 +++ src/commif_t.h 2011-03-23 19:18:45.000000000 +0100 @@ -20,6 +20,7 @@ class CommIF static void SCREENSHOT(unsigned char marker); // nevm/BF static void DUMPCSV(unsigned char marker); // dl3daz/BF + static void DUMPMEAS(unsigned char marker); static void SCREENSHOT_BW(void); // nevm diff -upNr ../Build-f/orig-src-2.15/floatstr_t.cpp src/floatstr_t.cpp --- ../Build-f/orig-src-2.15/floatstr_t.cpp 2011-03-04 14:45:19.000000000 +0100 +++ src/floatstr_t.cpp 2011-03-13 07:56:24.000000000 +0100 @@ -4,7 +4,7 @@ #include "floatstr_t.h" // Class FloatStr -void FloatStr::Init(float In_Value, float In_Min_Value, float In_Max_Value, float In_StepSize, int In_AfterDot, int In_MaxLength, char In_Text[20], char In_PreText[10], char In_Unit[5]) +void FloatStr::Init(float In_Value, float In_Min_Value, float In_Max_Value, float In_StepSize, int In_MaxLength, int In_AfterDot, char In_Text[20], char In_PreText[10], char In_Unit[5]) { Value = In_Value; Stored_Value = In_Value; @@ -31,6 +31,16 @@ float FloatStr::Read_Value(void) return Value; } +int FloatStr::Read_IntBDot(void) +{ + return Value_BDot; +} + +int FloatStr::Read_IntADot(void) +{ + return Value_ADot; +} + void FloatStr::Write_Value(float In_Value) { Value = In_Value; @@ -288,6 +298,9 @@ void FloatStr::RenderText(void) case 4: sprintf(Text, "%s%3d.%04d %s%s", PreText, intbd, intad, DimensionUnit, Unit); break; } + // copy values to protected variables for readout via Read_Int(B/A)Dot() + Value_BDot = intbd; + Value_ADot = intad; } char* FloatStr::Read_Text(void) @@ -310,6 +323,11 @@ char* FloatStr::Read_Unit(void) return(&Unit[0]); } +char* FloatStr::Read_DimensionUnit(void) +{ + return(&DimensionUnit[0]); +} + void FloatStr::Write_Unit(char In_Unit[5]) { sprintf(Unit, "%s", In_Unit); diff -upNr ../Build-f/orig-src-2.15/floatstr_t.h src/floatstr_t.h --- ../Build-f/orig-src-2.15/floatstr_t.h 2009-07-20 09:08:12.000000000 +0200 +++ src/floatstr_t.h 2011-03-13 07:55:04.000000000 +0100 @@ -15,6 +15,9 @@ protected: int AfterDot; int MaxLength; + int Value_BDot; + int Value_ADot; + char Text[30]; char PreText[15]; char Unit[5]; @@ -42,10 +45,14 @@ public: void Write_PreText(char In_PreText[10]); char* Read_Unit(void); void Write_Unit(char In_Unit[5]); + char* Read_DimensionUnit(void); void RenderText(void); void DoStep(char Direction); //void floatprintf(float fvalue); + + int Read_IntBDot(void); + int Read_IntADot(void); }; #endif diff -upNr ../Build-f/orig-src-2.15/tc_vars.cpp src/tc_vars.cpp --- ../Build-f/orig-src-2.15/tc_vars.cpp 2011-03-09 21:08:10.000000000 +0100 +++ src/tc_vars.cpp 2011-03-23 19:21:22.000000000 +0100 @@ -9,7 +9,7 @@ unsigned long tc_varstart = 0xAABBCCDD; unsigned long tc_version = 0x00000001; // Factory version 1 unsigned long tc_subversion = 0x00000002; // Factory subversion 2 unsigned long tc_dev_version = 0x00000002; // Developer version -unsigned long tc_dev_subversion = 0x0000000F; // Developer subversion +unsigned long tc_dev_subversion = 0x00000010; // Developer subversion char tc_compilation[6] = {""}; // Compilation unsigned long tc_hw_sw_version = 0x00000000; // Type 0 = W2012 1 = W2014 2 = W2022 3 = W2024 unsigned long tc_hw_version = 0x00000000; // Hardware version @@ -22,37 +22,6 @@ unsigned long tc_production_lot2 = 0x unsigned long tc_shipment_date = 0x00000000; // 2C7 -const unsigned char Colors[7][3] = { {0x0A, 0x0F, 0x2F}, // Yellow ( 10, 15, 47 ) - {0x28, 0x3C, 0x3E}, // Cyan ( 40, 60, 62 ) - {0x11, 0x23, 0x26}, // Purple ( 17, 35, 38 ) - {0x04, 0x08, 0x0C}, // Green ( 4, 8, 12 ) - {0x01, 0x02, 0x03}, // Red ( 1, 2, 3 ) - {0x10, 0x20, 0x30}, // Blue ( 16, 32, 48 ) - {0x00, 0x2A, 0x3F}}; // Black 0 , Gray , White 63 - -const unsigned char clYellow = 0x2F; -const unsigned char clCyan = 0x3E; -const unsigned char clPurple = 0x26; -const unsigned char clGreen = 0x0C; -const unsigned char clRed = 0x03; -const unsigned char clBlue = 0x30; -const unsigned char clBlack = 0x00; -const unsigned char clGray = 0x2A; -const unsigned char clDarkGray = 0x15; -const unsigned char clWhite = 0x3F; -const unsigned char clOrange = 0x0B; - -const unsigned char clCHI = 0x0F; -const unsigned char clCHII = 0x0C; -const unsigned char clCHIII = 0x33; -const unsigned char clCHIV = 0x13; - -const unsigned char clBackground = 0x00; -const unsigned char clFrame = 0x1A;//0x14; -const unsigned char clButton = 0x0A;//0x0C; - -const unsigned char clCursor = 0x0B; - const unsigned char btnUnpushed = 0x00; const unsigned char btnPushed = 0x01; @@ -2030,10 +1999,6 @@ FloatStr QM_Slot1; FloatStr QM_Slot2; FloatStr QM_Slot3; -FloatStr QM_Slot1_Value; -FloatStr QM_Slot2_Value; -FloatStr QM_Slot3_Value; - FloatStr QM_Threshold_lower; FloatStr QM_Threshold_middle; FloatStr QM_Threshold_upper; diff -upNr ../Build-f/orig-src-2.15/tc_vars.h src/tc_vars.h --- ../Build-f/orig-src-2.15/tc_vars.h 2011-03-09 21:06:17.000000000 +0100 +++ src/tc_vars.h 2011-03-20 23:15:50.000000000 +0100 @@ -267,26 +267,6 @@ extern unsigned long tc_shipment_date ;; extern const unsigned char C_GROUND_SIGN ;; extern const unsigned char C_MENU_SELECT_SIGN ;; -extern const unsigned char Colors[7][3] ; -extern const unsigned char clYellow ;; -extern const unsigned char clCyan ;; -extern const unsigned char clPurple ;; -extern const unsigned char clGreen ;; -extern const unsigned char clRed ;; -extern const unsigned char clBlue ;; -extern const unsigned char clBlack ;; -extern const unsigned char clGray ;; -extern const unsigned char clDarkGray ;; -extern const unsigned char clWhite ;; -extern const unsigned char clOrange ;; -extern const unsigned char clCHI ;; -extern const unsigned char clCHII ;; -extern const unsigned char clCHIII ;; -extern const unsigned char clCHIV ;; -extern const unsigned char clBackground ;; -extern const unsigned char clFrame ;;//0x14; -extern const unsigned char clButton ;;//0x0C; -extern const unsigned char clCursor ;; extern const unsigned char btnUnpushed ;; extern const unsigned char btnPushed ;; extern const unsigned char btnDraw ;;