zipplet / hc05configtool

A tool for configuring HC-05 wireless modules easily.
MIT License
1 stars 0 forks source link

Not an issue but I added the bluetooth name #1

Open danjperron opened 6 years ago

danjperron commented 6 years ago

Cool All done in free pascal!

You should specify somewhere that's is free pascal!

I added the function to change the name of the bluetooth device. I can't have all my bluetooth to be all "hc-05". This way it is easier to identify the device.

113d112 < mod_name: ansistring; 130,134d128 < WriteLine(comhandle, 'AT+NAME?'); < mod_name := AfterColon(GetLine(comhandle)); < sleep(50); < tcflush(comhandle, TCIFLUSH); < 171d164 < writeln('Device name : ' + mod_name); 418,448d410 < Set name < -------------------------------------------------------------------------- } < procedure CommandSetName(comhandle: thandle); < const < COMMAND_ERROR = 'Error: Module did not accept command'; < CONFIG_ERROR = 'Error: Module could not be configured correctly'; < ERRORMSG = 'Error: Unexpected response: '; < AT_OK = 'OK'; < begin < writeln('Set name to '+ paramstr(3)); < WriteLine(comhandle, 'AT+NAME=' + paramstr(3)); < {if GetLine(comhandle) <> AT_OK then begin < writeln(COMMAND_ERROR); < halt; < end;} < GetLine(comhandle); < < writeln('Confirming the configuration...'); < < WriteLine(comhandle, 'AT+NAME?'); < if AfterColon(GetLine(comhandle)) <> paramstr(3) then begin < writeln(CONFIG_ERROR); < halt; < end; < sleep(50); < tcflush(comhandle, TCIFLUSH); < < writeln('Complete.'); < end; < < { -------------------------------------------------------------------------- 669,670d630 < end else if cmd = 'setname' then begin < CommandSetName(comhandle);

zipplet commented 6 years ago

Thank you for your feedback! Yes, I should mention that I use freepascal to promote it a little more. Awesome language and compiler.

Thanks, I'll add your bluetooth device name function!