Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initialization to work with CC1101 #153

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void setup_gpio() {
#if defined(BACKLIGHT)
pinMode(BACKLIGHT, OUTPUT);
#endif
initCC1101once(); // Sets GPIO in the CC1101 lib
}


Expand Down Expand Up @@ -284,7 +285,7 @@ void setup() {
// start a task to handle serial commands while the webui is running
startSerialCommandsHandlerTask();
#endif

delay(200);
previousMillis = millis();
}
Expand All @@ -305,7 +306,7 @@ void loop() {
tft.fillRect(0,0,WIDTH,HEIGHT,BGCOLOR);
setupSdCard();
getConfigs();
if(RfModule==1) initCC1101once();


while(1){
if (returnToMenu) {
Expand Down
5 changes: 5 additions & 0 deletions src/modules/rf/rf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,17 @@ void initCC1101once() {
#else
ELECHOUSE_cc1101.setGDO0(CC1101_GDO0_PIN); // use Gdo0 for both Tx and Rx
#endif
/*
Don't need to start comunications now
if (ELECHOUSE_cc1101.getCC1101()){ // Check the CC1101 Spi connection.
Serial.println("cc1101 Connection OK");
} else {
Serial.println("cc1101 Connection Error");
return;
}
ELECHOUSE_cc1101.Init();
*/

#else
Serial.println("Error: USE_CC1101_VIA_SPI not defined for this board");
//TODO: interface using PCA9554
Expand All @@ -383,6 +387,7 @@ bool initRfModule(String mode, float frequency) {

if(RfModule == 1) { // CC1101 in use
#ifdef USE_CC1101_VIA_SPI
ELECHOUSE_cc1101.Init();
if (ELECHOUSE_cc1101.getCC1101()){ // Check the CC1101 Spi connection.
Serial.println("cc1101 Connection OK");
} else {
Expand Down
Loading