@caseywebb/growhaus
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -5,2 +5,4 @@ # Changelog | ||
### [1.1.1](https://github.com/caseyWebb/growhaus/compare/v1.1.0...v1.1.1) (2020-05-05) | ||
## [1.1.0](https://github.com/caseyWebb/growhaus/compare/v0.0.1...v1.1.0) (2020-05-05) | ||
@@ -7,0 +9,0 @@ |
@@ -7,3 +7,3 @@ import { LedOption } from 'pi-io'; | ||
constructor(); | ||
setBrightness(percentage: number): Promise<void>; | ||
setBrightness(intensity: number): Promise<void>; | ||
} | ||
@@ -10,0 +10,0 @@ export declare const driver: LedDriver; |
@@ -24,10 +24,10 @@ "use strict"; | ||
} | ||
async setBrightness(percentage) { | ||
async setBrightness(intensity) { | ||
await this.ready; | ||
percentage = Math.min(Math.max(percentage, 0), 100); | ||
logger_1.log(`Setting brightness to ${percentage}%`); | ||
intensity = Math.min(Math.max(intensity, 0), 255); | ||
logger_1.log(`Setting brightness to ${intensity}`); | ||
this.led.on(); | ||
this.led.brightness(255 - Math.round((percentage / 100) * 255)); | ||
this.led.brightness(255 - intensity); | ||
} | ||
} | ||
exports.driver = new LedDriver(); |
@@ -28,10 +28,10 @@ "use strict"; | ||
if (nowH > peakBegin && nowH < peakEnd) | ||
return 100; | ||
return 255; | ||
const transitionPeriodLengthInMinutes = (nowH < 12 ? peakBegin - dayBegin : dayEnd - peakEnd) * 60; | ||
const transitionPeriodProgressInMinutes = (nowH - (nowH < 12 ? dayBegin : peakEnd)) * 60 + nowM; | ||
const progress = Math.round((100 * transitionPeriodProgressInMinutes) / | ||
const progress = Math.round((255 * transitionPeriodProgressInMinutes) / | ||
transitionPeriodLengthInMinutes); | ||
return nowH > 12 ? 100 - progress : progress; | ||
return nowH > 12 ? 255 - progress : progress; | ||
} | ||
} | ||
exports.LightSchedule = LightSchedule; |
{ | ||
"name": "@caseywebb/growhaus", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "WTFPL", | ||
@@ -5,0 +5,0 @@ "bin": "./bin/growhaus", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10157