forked from melkati/CO2-Gadget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guardando cambios locales antes de la actualización
- Loading branch information
Showing
14 changed files
with
729 additions
and
201 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
.github/PULL_REQUEST_TEMPLATE/dev_pull_request_template.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
# What does this implement/fix? | ||
|
||
<!-- Quick description and explanation of changes --> | ||
|
||
## Types of changes | ||
|
||
- [ ] Bugfix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] Other | ||
|
||
**Related issue or feature (if applicable):** fixes <link to issue> | ||
|
||
## Test Environment | ||
|
||
- [ ] TTGO T-Display | ||
- [ ] TTGO T-Display Sandwich | ||
- [ ] ESP8266T-Display S3 | ||
- [ ] Other (specify) | ||
|
||
## Checklist: | ||
- [ ] The code change is tested and works locally. | ||
|
||
If platfomio.ini or preferences are added/changed: | ||
- [ ] Add explanation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#ifndef CO2_Gadget_Buzzer_h | ||
#define CO2_Gadget_Buzzer_h | ||
|
||
/*****************************************************************************************************/ | ||
/********* *********/ | ||
/********* SETUP BUZZER *********/ | ||
/********* *********/ | ||
/*****************************************************************************************************/ | ||
|
||
// #define BUZZER_DEBUG | ||
bool belowRedRange = true; | ||
|
||
void beepBuzzer() { | ||
static uint16_t numberOfBeepsLeft = 2; | ||
static uint64_t timeNextBeep = 0; | ||
if (millis() > timeNextBeep) { | ||
if (numberOfBeepsLeft == 0) { | ||
if (timeBetweenBuzzerBeeps > 0) { | ||
timeNextBeep = millis() + timeBetweenBuzzerBeeps * 1000; | ||
} else { | ||
belowRedRange = false; | ||
} | ||
numberOfBeepsLeft = 2; | ||
buzzerBeeping = false; | ||
} else { | ||
#ifdef BUZZER_DEBUG | ||
Serial.printf("[BUZZ] Beeps left: %d. Next beep in: %d sec. Beep duration: %d ms\n", numberOfBeepsLeft, timeBetweenBuzzerBeeps, durationBuzzerBeep); | ||
#endif | ||
tone(BUZZER_PIN, toneBuzzerBeep, durationBuzzerBeep); | ||
timeNextBeep = millis() + durationBuzzerBeep + (durationBuzzerBeep * 1.3); | ||
--numberOfBeepsLeft; | ||
buzzerBeeping = true; | ||
} | ||
} | ||
} | ||
|
||
void buzzerLoop() { | ||
#ifdef SUPPORT_BUZZER | ||
if (timeBetweenBuzzerBeeps == -1 || inMenu) { // Inside Menu stop BEEPING | ||
buzzerBeeping = false; | ||
belowRedRange = true; | ||
return; | ||
} | ||
|
||
if (co2 > co2RedRange && belowRedRange) { | ||
shouldWakeUpDisplay = true; | ||
beepBuzzer(); | ||
} else if (co2 < (co2RedRange - BUZZER_HYSTERESIS)) | ||
belowRedRange = true; | ||
#endif | ||
} | ||
|
||
void initBuzzer() { | ||
#ifdef SUPPORT_BUZZER | ||
Serial.printf("-->[BUZZ] Initializing Buzzer on GPIO %d...\n", BUZZER_PIN); | ||
pinMode(BUZZER_PIN, OUTPUT); | ||
|
||
// LEDC initialization | ||
ledcSetup(0, 5000, 8); | ||
ledcAttachPin(BUZZER_PIN, 0); | ||
#endif | ||
} | ||
|
||
#endif |
Oops, something went wrong.