Skip to content

Commit 0cab6ad

Browse files
* Export battery voltage x10 in caloris field
* Set version to 1.1
1 parent cd1b9f8 commit 0cab6ad

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/firmware/extcom.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#define OPCODE_BAFANG_DISPLAY_READ_SPEED 0x20
5454
#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN1 0x21
5555
#define OPCODE_BAFANG_DISPLAY_READ_RANGE 0x22
56-
#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN2 0x24
56+
#define OPCODE_BAFANG_DISPLAY_READ_CALORIES 0x24
5757
#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN3 0x25
5858
#define OPCODE_BAFANG_DISPLAY_READ_MOVING 0x31
5959

@@ -104,7 +104,7 @@ static int16_t process_bafang_display_read_battery();
104104
static int16_t process_bafang_display_read_speed();
105105
static int16_t process_bafang_display_read_unknown1();
106106
static int16_t process_bafang_display_read_range();
107-
static int16_t process_bafang_display_read_unknown2();
107+
static int16_t process_bafang_display_read_calories();
108108
static int16_t process_bafang_display_read_unknown3();
109109
static int16_t process_bafang_display_read_moving();
110110

@@ -282,8 +282,8 @@ static int16_t try_process_bafang_read_request()
282282
return process_bafang_display_read_unknown1();
283283
case OPCODE_BAFANG_DISPLAY_READ_RANGE:
284284
return process_bafang_display_read_range();
285-
case OPCODE_BAFANG_DISPLAY_READ_UNKNOWN2:
286-
return process_bafang_display_read_unknown2();
285+
case OPCODE_BAFANG_DISPLAY_READ_CALORIES:
286+
return process_bafang_display_read_calories();
287287
case OPCODE_BAFANG_DISPLAY_READ_UNKNOWN3:
288288
return process_bafang_display_read_unknown3();
289289
case OPCODE_BAFANG_DISPLAY_READ_MOVING:
@@ -582,16 +582,21 @@ static int16_t process_bafang_display_read_range()
582582
return 3;
583583
}
584584

585-
static int16_t process_bafang_display_read_unknown2()
585+
static int16_t process_bafang_display_read_calories()
586586
{
587587
if (msg_len < 3)
588588
{
589589
return KEEP;
590590
}
591591

592-
uart1_write(0x00);
593-
uart1_write(0x00);
594-
uart1_write(0x00); // checksum
592+
uint8_t checksum = 0;
593+
594+
// send battery voltage x10 to show in calories field
595+
uint16_t volt = motor_get_battery_voltage_x10();
596+
597+
write_uart1_and_increment_checksum(volt >> 8, & checksum);
598+
write_uart1_and_increment_checksum(volt & 0xff, & checksum);
599+
uart1_write(checksum); // checksum
595600

596601
return 3;
597602
}

src/firmware/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#define VERSION_MAJOR 1
1313
#define VERSION_MINOR 1
14-
#define VERSION_PATCH 0
14+
#define VERSION_PATCH 1
1515

1616

1717
#if defined(BBSHD)

src/tool/bbs-fw-tool.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<UseWPF>true</UseWPF>
1313
<AssemblyName>BBSFWTool</AssemblyName>
1414
<Authors>Daniel Nilsson</Authors>
15-
<AssemblyVersion>1.1.0.0</AssemblyVersion>
16-
<FileVersion>1.1.0.0</FileVersion>
15+
<AssemblyVersion>1.1.1.0</AssemblyVersion>
16+
<FileVersion>1.1.1.0</FileVersion>
1717
</PropertyGroup>
1818

1919
<ItemGroup>

0 commit comments

Comments
 (0)