@ginden/blinkstick-v2
Version:
Improved Blickstick API for Node.js
36 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.determineReportId = determineReportId;
const types_1 = require("../../types");
/**
* Determines report ID and number of LEDs for the report
*/
function determineReportId(ledCount) {
// WEIRD - Python code uses `<=`, but Node code used `<` here.
if (ledCount <= 8 * 3) {
return {
reportId: types_1.FeatureReportId.Set8Pixels,
maxLeds: 8,
};
}
else if (ledCount <= 16 * 3) {
return {
reportId: types_1.FeatureReportId.Set16Pixels,
maxLeds: 16,
};
}
else if (ledCount <= 32 * 3) {
return {
reportId: types_1.FeatureReportId.Set32Pixels,
maxLeds: 32,
};
}
else if (ledCount <= 64 * 3) {
return {
reportId: types_1.FeatureReportId.Set64Pixels,
maxLeds: 64,
};
}
return { reportId: types_1.FeatureReportId.Set64Pixels, maxLeds: 64 };
}
//# sourceMappingURL=determine-report-id.js.map