@@ -195,7 +195,7 @@ INT_8 rq_sensor_com()
195
195
if (!GetCommState (hSerial, &dcb)){
196
196
CloseHandle (hSerial);
197
197
hSerial = INVALID_HANDLE_VALUE;
198
- continue ;// Permet de recommencer la boucle
198
+ continue ;// Allows to start the loop again
199
199
}
200
200
dcb.BaudRate = CBR_19200;
201
201
dcb.ByteSize = 8 ;
@@ -218,7 +218,7 @@ INT_8 rq_sensor_com()
218
218
/* Setup port */
219
219
if (!SetCommState (hSerial, &dcb)){
220
220
CloseHandle (hSerial);
221
- continue ;// Permet de recommencer la boucle
221
+ continue ;// Allows to start the loop again
222
222
}
223
223
COMMTIMEOUTS timeouts={0 };
224
224
timeouts.ReadIntervalTimeout =0 ;
@@ -229,7 +229,7 @@ INT_8 rq_sensor_com()
229
229
if (!SetCommTimeouts (hSerial, &timeouts)){
230
230
CloseHandle (hSerial);
231
231
hSerial = INVALID_HANDLE_VALUE;
232
- continue ;// Permet de recommencer la boucle
232
+ continue ;// Allows to start the loop again
233
233
}
234
234
if (rq_com_tentative_connexion () == 1 ){
235
235
return 0 ;
@@ -378,7 +378,7 @@ void rq_com_listen_stream(void)
378
378
rq_com_timer_for_stream_detection = 0 ;
379
379
}
380
380
381
- // Copie les données au bout du buffer 2
381
+ // Copying the data at the end of buffer 2
382
382
for (i = 0 ; i < rq_com_rcv_len; i++)
383
383
{
384
384
// If the buffer overflows, set the index to the beginning
@@ -450,7 +450,7 @@ void rq_com_listen_stream(void)
450
450
451
451
if (last_byte > 0 )
452
452
{
453
- // On shift le buffer 2 afin de ne garder que ce qui dépasse le dernier caractère du dernier message complet
453
+ // Shifts the buffer 2 to keep only what's after the last caracter of the last complete message.
454
454
for (i = 0 ; i < (rq_com_rcv_len2 - last_byte - 1 ); i++)
455
455
{
456
456
rq_com_rcv_buff2[i] = rq_com_rcv_buff2[last_byte + 1 + i];
@@ -643,7 +643,7 @@ static INT_8 rq_com_send_fc_16(INT_32 base, INT_32 n, UINT_16 const * const data
643
643
*/
644
644
void rq_sensor_com_read_info_high_lvl (void )
645
645
{
646
- UINT_16 registers[4 ] = {0 };// table de registre
646
+ UINT_16 registers[4 ] = {0 };// register table
647
647
UINT_64 serial_number = 0 ;
648
648
INT_32 result = 0 ;
649
649
@@ -742,39 +742,39 @@ static UINT_16 rq_com_compute_crc(UINT_8 const * adr, INT_32 length )
742
742
return 0 ;
743
743
}
744
744
745
- // Tant qu'il reste des bytes dans le message
745
+ // While there are bytes left in the message
746
746
while (j < length)
747
747
{
748
- // Si c'est le premier byte
748
+ // If it's the first byte
749
749
if (j==0 )
750
750
{
751
751
CRC_calc ^= *adr & 0xFF ;
752
752
}
753
- // Sinon on utilisera un XOR sur le word
753
+ // Else we'll use an XOR on the word
754
754
else
755
755
{
756
756
CRC_calc ^= *adr;
757
757
}
758
758
759
759
k=0 ;
760
760
761
- // Tant que le byte n'est pas complété
761
+ // While the byte is not completed
762
762
while (k < 8 )
763
763
{
764
- // Si le dernier bit est un 1
764
+ // If the last bit is a 1
765
765
if (CRC_calc & 0x0001 )
766
766
{
767
- CRC_calc = (CRC_calc >> 1 )^ 0xA001 ; // Shift de 1 bit vers la droite et XOR avec le facteur polynomial
767
+ CRC_calc = (CRC_calc >> 1 )^ 0xA001 ; // Shifts 1 bit to the right and XOR with the polynomial factor
768
768
}
769
769
else
770
770
{
771
- CRC_calc >>= 1 ; // Shift de 1 bit vers la droite
771
+ CRC_calc >>= 1 ; // Shifts 1 bit to the right
772
772
}
773
773
774
774
k++;
775
775
}
776
776
777
- // Incrémente l'adresse et le compteur d'adresse
777
+ // Increments address and address counter
778
778
adr++;
779
779
j++;
780
780
}
@@ -796,13 +796,13 @@ static void rq_com_send_fc_03_request(UINT_16 base, UINT_16 n)
796
796
UINT_8 words[2 ];
797
797
UINT_16 CRC;
798
798
799
- // Si le nombre de registre est impair
799
+ // Manage if the number of bytes to write is odd or even
800
800
if (n % 2 != 0 )
801
801
{
802
802
n += 1 ;
803
803
}
804
804
805
- // Scinder en LSB et MSB
805
+ // Split the address and the number of bytes between MSB ans LSB
806
806
reg[0 ] = (UINT_8)(base >> 8 ); // MSB to the left
807
807
reg[1 ] = (UINT_8)(base & 0x00FF ); // LSB to the right
808
808
words[0 ] = (UINT_8)((n/2 ) >> 8 ); // MSB to the left
@@ -896,7 +896,7 @@ static INT_32 rq_com_wait_for_fc_03_echo(UINT_8 * const data)
896
896
// Verifies the crc and the slave ID
897
897
if (CRC != (UINT_16)((buf[length - 1 ] * 256 ) + (buf[length - 2 ])))
898
898
{
899
- // On clear le buffer
899
+ // Clears the buffer
900
900
buf[0 ] = 0 ;
901
901
length = 0 ;
902
902
return 0 ;
0 commit comments