Skip to content

Commit

Permalink
* Export battery voltage x10 in caloris field
Browse files Browse the repository at this point in the history
* Set version to 1.1
  • Loading branch information
danielnilsson9 committed Sep 11, 2022
1 parent cd1b9f8 commit 0cab6ad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
21 changes: 13 additions & 8 deletions src/firmware/extcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#define OPCODE_BAFANG_DISPLAY_READ_SPEED 0x20
#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN1 0x21
#define OPCODE_BAFANG_DISPLAY_READ_RANGE 0x22
#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN2 0x24
#define OPCODE_BAFANG_DISPLAY_READ_CALORIES 0x24
#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN3 0x25
#define OPCODE_BAFANG_DISPLAY_READ_MOVING 0x31

Expand Down Expand Up @@ -104,7 +104,7 @@ static int16_t process_bafang_display_read_battery();
static int16_t process_bafang_display_read_speed();
static int16_t process_bafang_display_read_unknown1();
static int16_t process_bafang_display_read_range();
static int16_t process_bafang_display_read_unknown2();
static int16_t process_bafang_display_read_calories();
static int16_t process_bafang_display_read_unknown3();
static int16_t process_bafang_display_read_moving();

Expand Down Expand Up @@ -282,8 +282,8 @@ static int16_t try_process_bafang_read_request()
return process_bafang_display_read_unknown1();
case OPCODE_BAFANG_DISPLAY_READ_RANGE:
return process_bafang_display_read_range();
case OPCODE_BAFANG_DISPLAY_READ_UNKNOWN2:
return process_bafang_display_read_unknown2();
case OPCODE_BAFANG_DISPLAY_READ_CALORIES:
return process_bafang_display_read_calories();
case OPCODE_BAFANG_DISPLAY_READ_UNKNOWN3:
return process_bafang_display_read_unknown3();
case OPCODE_BAFANG_DISPLAY_READ_MOVING:
Expand Down Expand Up @@ -582,16 +582,21 @@ static int16_t process_bafang_display_read_range()
return 3;
}

static int16_t process_bafang_display_read_unknown2()
static int16_t process_bafang_display_read_calories()
{
if (msg_len < 3)
{
return KEEP;
}

uart1_write(0x00);
uart1_write(0x00);
uart1_write(0x00); // checksum
uint8_t checksum = 0;

// send battery voltage x10 to show in calories field
uint16_t volt = motor_get_battery_voltage_x10();

write_uart1_and_increment_checksum(volt >> 8, & checksum);
write_uart1_and_increment_checksum(volt & 0xff, & checksum);
uart1_write(checksum); // checksum

return 3;
}
Expand Down
2 changes: 1 addition & 1 deletion src/firmware/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#define VERSION_MAJOR 1
#define VERSION_MINOR 1
#define VERSION_PATCH 0
#define VERSION_PATCH 1


#if defined(BBSHD)
Expand Down
4 changes: 2 additions & 2 deletions src/tool/bbs-fw-tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<UseWPF>true</UseWPF>
<AssemblyName>BBSFWTool</AssemblyName>
<Authors>Daniel Nilsson</Authors>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<AssemblyVersion>1.1.1.0</AssemblyVersion>
<FileVersion>1.1.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 0cab6ad

Please sign in to comment.