Skip to content

Commit 683789f

Browse files
authored
Merge pull request #526 from atomgomba/feature/motor-poles-support
Add motor poles support
2 parents c7ff021 + cc4aa95 commit 683789f

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,10 @@ <h5 class="modal-title-craft"></h5>
14721472
<!-- list generated here -->
14731473
</select>
14741474
</td>
1475+
<td name='motor_poles'>
1476+
<label>Motor poles</label>
1477+
<input type="number" step="1" min="0" max="8" />
1478+
</td>
14751479
</tr>
14761480
</tbody>
14771481
</table>

js/flightlog_fields_presenter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ function FlightLogFieldPresenter() {
739739
return value.toFixed(0) + "Hz";
740740
}
741741
case 'DSHOT_RPM_TELEMETRY':
742-
return value.toFixed(0) + "erpm";
742+
return (value * 50 / flightLog.getSysConfig()['motor_poles']).toFixed(0) + "RPM";
743743
case 'RPM_FILTER':
744744
return value.toFixed(0) + "Hz";
745745
case 'D_MIN':

js/flightlog_parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ var FlightLogParser = function(logData) {
309309
vbat_sag_compensation: null,
310310
gyro_to_use: null,
311311
dynamic_idle_min_rpm: null,
312+
motor_poles: 1,
312313
unknownHeaders : [] // Unknown Extra Headers
313314
},
314315

@@ -626,6 +627,7 @@ var FlightLogParser = function(logData) {
626627
case "motor_pwm_protocol":
627628
case "gyro_to_use":
628629
case "dynamic_idle_min_rpm":
630+
case "motor_poles":
629631
that.sysConfig[fieldName] = parseInt(fieldValue, 10);
630632
break;
631633
case "rc_expo":

js/header_dialog.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function HeaderDialog(dialog, onSave) {
101101
{name:'vbat_sag_compensation' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
102102
{name:'gyro_to_use' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
103103
{name:'dynamic_idle_min_rpm' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
104+
{name:'motor_poles' , type:FIRMWARE_TYPE_BETAFLIGHT, min:'4.3.0', max:'999.9.9'},
104105
];
105106

106107
function isParameterValid(name) {
@@ -771,6 +772,7 @@ function HeaderDialog(dialog, onSave) {
771772
renderSelect('baro_hardware' ,sysConfig.baro_hardware, BARO_HARDWARE);
772773
renderSelect('mag_hardware' ,sysConfig.mag_hardware, MAG_HARDWARE);
773774
renderSelect('gyro_to_use' ,sysConfig.gyro_to_use, GYRO_TO_USE);
775+
setParameter('motor_poles' ,sysConfig.motor_poles, 0);
774776

775777
/* Booleans */
776778
setCheckbox('gyro_cal_on_first_arm' ,sysConfig.gyro_cal_on_first_arm);

0 commit comments

Comments
 (0)