Permalink
Browse files

Update Commit

- mainly a bugfix release...
  • Loading branch information...
1 parent 58f4944 commit da96e663a8fe83ec415ea32743651fd39fb32bbe @azman committed Nov 9, 2012
Showing with 69 additions and 3 deletions.
  1. +11 −0 CHANGELOG
  2. +1 −1 VERSION
  3. +57 −2 src/my1termu.c
View
@@ -1,3 +1,14 @@
+**************
+my1termu-1.3.3
+**************
+
+Update:
+- switching to next baudrate within program (my1termu)
+- display effective baudrate (my1termu)
+
+Bugfix:
+- newline char is in the filename for send file option (my1termu)
+
**************
my1termu-1.3.2
**************
View
@@ -1 +1 @@
-1.3.2
+1.3.3
View
@@ -284,6 +284,7 @@ int main(int argc, char* argv[])
printf("<F8> - Toggle 115200-8N1 Connection\n");
printf("<F9> - Clear Input/Output Buffer\n");
printf("<F10> - Exit this program\n");
+ printf("<F11> - Try another baudrate\n");
printf("<F12> - Toggle Command/Raw Mode\n\n");
}
else if(key==KEY_F2) /* send file */
@@ -295,6 +296,16 @@ int main(int argc, char* argv[])
printf("\nNo valid input!\n\n");
continue;
}
+ /* have to filter out newline */
+ for(loop=0;loop<FILENAME_LEN;loop++)
+ {
+ if(filename[loop]=='\n'||filename[loop]=='\r'||
+ filename[loop]==0x0)
+ {
+ filename[loop] = 0x0;
+ break;
+ }
+ }
pfile = fopen(filename,"rb");
if(pfile==NULL)
{
@@ -333,8 +344,22 @@ int main(int argc, char* argv[])
else printf("\nLocal echo OFF!");
if(options&OPT_LF4CR) printf("\nLF4CR option ON!");
else printf("\nLF4CR option OFF!");
- if(options&OPT_SHOWHEX) printf("\nHex Display Mode ON!\n\n");
- else printf("\nHex Display Mode OFF!\n\n");
+ if(options&OPT_SHOWHEX) printf("\nHex Display Mode ON!\n");
+ else printf("\nHex Display Mode OFF!\n");
+ get_serialconfig(&cPort,&cConfig);
+ switch(cConfig.mBaudRate)
+ {
+ default:
+ case MY1BAUD9600: loop = 9600; break;
+ case MY1BAUD19200: loop = 19200; break;
+ case MY1BAUD38400: loop = 38400; break;
+ case MY1BAUD57600: loop = 57600; break;
+ case MY1BAUD115200: loop = 115200; break;
+ case MY1BAUD230400: loop = 230400; break;
+ case MY1BAUD460800: loop = 460800; break;
+ case MY1BAUD921600: loop = 921600; break;
+ }
+ printf("Effective baudrate: %d\n\n",loop);
}
else if(key==KEY_F5) /* toggle local echo */
{
@@ -384,6 +409,36 @@ int main(int argc, char* argv[])
printf("\n\nUser Exit Request! Program '%s' Ends.\n\n",PROGNAME);
break;
}
+ else if(key==KEY_F11)
+ {
+ close_port(&cPort);
+ get_serialconfig(&cPort,&cConfig);
+ switch(cConfig.mBaudRate)
+ {
+ default:
+ case MY1BAUD9600: loop = 9600; break;
+ case MY1BAUD19200: loop = 19200; break;
+ case MY1BAUD38400: loop = 38400; break;
+ case MY1BAUD57600: loop = 57600; break;
+ case MY1BAUD115200: loop = 115200; break;
+ case MY1BAUD230400: loop = 230400; break;
+ case MY1BAUD460800: loop = 460800; break;
+ case MY1BAUD921600: loop = 921600; break;
+ }
+ printf("Current baudrate: %d\n\n",loop);
+ loop = (loop==MY1BAUD921600?MY1BAUD9600:loop+1);
+ printf("Setting baudrate: %d\n\n",loop);
+ set_serialconfig(&cPort,&cConfig);
+ /* try reopen */
+ if(!open_port(&cPort))
+ {
+ printf("\n\nCannot open port '%s'!\n\n",cPort.mPortName);
+ break;
+ }
+ /* clear input buffer */
+ clear_ibuffer(&cPort);
+ break;
+ }
else if((key&~0xFF)==0x00) /* print non-control keys */
{
sendprint(&cPort,key,options);

0 comments on commit da96e66

Please sign in to comment.