Skip to content

Commit

Permalink
fix: fix compilation on esp32 (#4)
Browse files Browse the repository at this point in the history
* chore: #ifdef AVR

* chore: #ifdef AVR - V2

* chore: add last option

* chore: maybe also check if another arch actually compiles?

* fix: also install ESP32 cli core

* chore: maybe actually install the package we intend to use

* Update RedMP3.h

* Update RedMP3.cpp

* chore: some more avr only shi

* fix: remove some more avr shi

* chore: remove some more broken shi bc why check your code on all arches

* chore: look above

* chore: ifdev -> ifdef

* chore: bump version

* chore: maybe don't comment everything out

* chore: no

* chore: remove LSM303AGR.*

* chore: remove #ifdef AVR

* chore: remove #ifdef AVR
  • Loading branch information
koen1711 authored Feb 17, 2025
1 parent 01c1e26 commit 3a9f374
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 78 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
|
# Install arduino AVR
arduino-cli core install arduino:avr
arduino-cli core install arduino:esp32
# Install dependencies
libs=$(cat library.properties | grep depends | sed 's/depends=//g')
IFS=',' read -ra lib <<< "$libs"
Expand All @@ -37,3 +38,4 @@ jobs:
|
# Perform test compile
arduino-cli compile tests --fqbn arduino:avr:uno --log --library . --clean
arduino-cli compile tests --fqbn arduino:esp32:nano_nora --log --library . --clean
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Leaphy Extensions
version=1.0.1
version=1.0.2
author=Leaphy Robotics
maintainer=Leaphy Robotics <[email protected]>
sentence=Provides functionality to program all Leaphy robots
Expand All @@ -9,5 +9,5 @@ url=https://github.com/leaphy-robotics/leaphy-extensions
architectures=avr
# Only include actually used library code in the resulting executable
dot_a_linkage=true
depends=Adafruit SSD1306,Adafruit GFX Library,Adafruit LSM303 Accel,Adafruit LIS2MDL,Adafruit BusIO,Adafruit_VL53L0X,Adafruit NeoPixel
depends=Adafruit SSD1306,Adafruit GFX Library,Adafruit LSM303 Accel,Adafruit LIS2MDL,Adafruit BusIO,Adafruit_VL53L0X,Adafruit NeoPixel,EspSoftwareSerial

48 changes: 0 additions & 48 deletions src/LSM303AGR.cpp

This file was deleted.

26 changes: 0 additions & 26 deletions src/LSM303AGR.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/Leaphyoriginal1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// suitable for Fundumoto Shield
// Copyright Science4Kids& Stichting Leaphy 2018
// version 1.0.0 25 JULI 2018

#include "Leaphyoriginal1.h"


Expand Down Expand Up @@ -100,3 +99,4 @@ void setLed(int fpRed, int fpGreen, int fpBlue)
analogWrite(LED1_GREEN, fpGreen);
analogWrite(LED1_BLUE, fpBlue);
}

1 change: 0 additions & 1 deletion src/Leaphyoriginal1.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#include <util/delay.h>
#include <stdint.h>
#include <stdlib.h>

Expand Down
8 changes: 8 additions & 0 deletions src/RedMP3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@
#include <SoftwareSerial.h>
#include "RedMP3.h"

#ifdef AVR
MP3::MP3(uint8_t rxd, uint8_t txd):myMP3(txd, rxd)
{
myMP3.begin(9600);//baud rate is 9600bps
}
#else
MP3::MP3(uint8_t rxd, uint8_t txd)
{
myMP3.begin(9600, SWSERIAL_8N1, txd, rxd, false);//baud rate is 9600bps
}
#endif

void MP3::begin()
{
sendCommand(CMD_SEL_DEV, DEV_TF);//select the TF card
Expand Down
4 changes: 4 additions & 0 deletions src/RedMP3.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ class MP3
void playCombine(int16_t folderAndIndex[], int8_t number);

private:
#ifdef AVR
SoftwareSerial myMP3;
#else
EspSoftwareSerial::UART myMP3;
#endif
void sendCommand(int8_t command, int16_t dat = 0);
void mp3Basic(int8_t command);
void mp3_5bytes(int8_t command, uint8_t dat);
Expand Down

0 comments on commit 3a9f374

Please sign in to comment.