defragster
Senior Member+
The reverse lines per second seems to be working at the same rate on PC: PC sends 19K strings to T4 sketch that counts \n and then the string to Serial2 once per second:
PC code uses same lps_test code with 'S' for send as param 2 - will post later.
There is some ECHO anomaly above with println('.'); is generally correct but with code as follows { #if 1 versus #if 0} I get a lot of this:
Output above using TyCommander - similar from using IDE SerMon - so seems to be a bug somewhere as T_3.5 gets it Serial2 then it sends out USB … will send text OUT Serial to PC and have it print instead:
Code:
count= 10976993, lines per second=18893.
[COLOR="#FF0000"]count= 10996057, lines per second=[/COLOR]19064. // [COLOR="#FF0000"]PC SENDS THIS[/COLOR]
count= 11014347, lines per second=18290.
count= 11032841, lines per second=18494.
count= 11051516, lines per second=[COLOR="#FF0000"]18675[/COLOR]. // [COLOR="#FF0000"]T4 calculates and appends this with print[/COLOR]
count= 11070233, lines per second=18717.
PC code uses same lps_test code with 'S' for send as param 2 - will post later.
There is some ECHO anomaly above with println('.'); is generally correct but with code as follows { #if 1 versus #if 0} I get a lot of this:
Code:
count= 10969835, lines per second=18854
count= 10988580, lines per second=187[COLOR="#FF0000"]45[/COLOR]
[COLOR="#FF0000"]45
[/COLOR]count= 11007214, lines per second=186[COLOR="#FF0000"]34[/COLOR]
[COLOR="#FF0000"]34
[/COLOR]count= 11026041, lines per second=18827
Output above using TyCommander - similar from using IDE SerMon - so seems to be a bug somewhere as T_3.5 gets it Serial2 then it sends out USB … will send text OUT Serial to PC and have it print instead:
Code:
count= 10465392, lines per second=19022
22
count= 10484416, lines per second=19024
count= 10503446, lines per second=19030
30
count= 10522287, lines per second=18841
count= 10540880, lines per second=18593
93
count= 10559403, lines per second=18523
23
count= 10578191, lines per second=18788
count= 10596470, lines per second=18279
79
count= 10615171, lines per second=18701
01
count= 10634039, lines per second=18868
count= 10652267, lines per second=18228
Code:
uint32_t count, prior_count;
uint32_t prior_msec;
uint32_t count_per_second;
void setup() {
Serial.begin(1000000);
Serial2.begin(2000000);
// while (!Serial) ;
count = 10000000;
prior_count = count;
count_per_second = 0;
prior_msec = millis();
}
void yield() {}
void loop() {
char c;
int ii = 0;
char buf[100];
while (Serial.available()) {
c = Serial.read();
if (c == '\n') {
count = count + 1;
uint32_t msec = millis();
if (msec - prior_msec > 1000) {
prior_msec = prior_msec + 1000;
count_per_second = count - prior_count;
prior_count = count;
buf[ii] = 0;
Serial2.print(buf);
#if 1 // this is showing echo on print of last digits of count_per_second and newlines
Serial2.println(count_per_second);
#else
Serial2.print(count_per_second);
Serial2.println('.');
#endif
ii = 0;
}
}
else {
buf[ii++] = c;
}
}
}