Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Green committed Aug 3, 2023
1 parent b22828e commit 1fedbd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/level/DP5200LevelSensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class DP5200Sensor implements LevelSensor {
readonly piServer: PiServer;
readonly log: Logger;

get fullLevel(): number {
return 1;
}

constructor(readonly options: DP5200Options) {
this.piServer = createPiServer(options);
this.log = createLogger(`LevelSensor(${options.type})`);
Expand All @@ -42,7 +46,7 @@ export class DP5200Sensor implements LevelSensor {
): Promise<number> {
try {
let level = await this.getLevelAveraged(averagingOptions);
while (level < 1) {
while (level < this.fullLevel) {
this.log.debug(`Waiting for level ${level} to equal 1`);

await wait(millisecondsDelay);
Expand Down
1 change: 1 addition & 0 deletions lib/level/LevelSensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface WaitForLevelOptions extends Partial<AveragingOptions> {
}

export interface LevelSensor {
get fullLevel(): number;
getLevel(): Promise<number>;
getLevelAveraged(options?: Partial<AveragingOptions>): Promise<number>;
waitUntilFull(
Expand Down

0 comments on commit 1fedbd1

Please sign in to comment.