Skip to content

Commit

Permalink
add Tx parameters WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stancecoke committed Oct 28, 2024
1 parent 2bd0ae1 commit 671ec2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Src/display_No_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void No2_Service(No2_t* No2_ctx)

if(No2_Message[19]==calculate_checksum(No2_Message, 20)){
//to do
No2_ctx->Rx.AssistLevel = No2_Message[4];
No2_ctx->Rx.AssistLevel = No2_Message[4]<<4; // value is in range 0 ... 15, leftshift 4 for range 0 ... 255
No2_ctx->Rx.NumberOfPasMagnets = No2_Message[18];
No2_ctx->Rx.CUR_Limit_A = No2_Message[13];
No2_ctx->Rx.Voltage_min_x10 = (No2_Message[14]<<8)+No2_Message[15];
Expand All @@ -116,6 +116,10 @@ void No2_Service(No2_t* No2_ctx)
No2_update(); //get/set parameters in main.c

//to do: apply speed and power data to TxBuffer
TxBuffer[6]=highByte(No2_ctx->Tx.Current_x10);
TxBuffer[7]=lowByte(No2_ctx->Tx.Current_x10);
TxBuffer[8]=highByte(No2_ctx->Tx.Wheeltime_ms);
TxBuffer[9]=lowByte(No2_ctx->Tx.Wheeltime_ms);

TxBuffer[13]=calculate_checksum(TxBuffer, 14);
HAL_UART_Transmit(&huart1, (uint8_t *)&TxBuffer,14,50);
Expand Down

0 comments on commit 671ec2e

Please sign in to comment.