0.4.251
This commit is contained in:
@@ -133,7 +133,7 @@ Rotation of the displays is configured in the files [src/displays/displayXXXXX.h
|
|||||||
````c++
|
````c++
|
||||||
#define TFT_ROTATE 3 // 180 degress
|
#define TFT_ROTATE 3 // 180 degress
|
||||||
````
|
````
|
||||||
If there is a noisy line on one side of the screen, then in Adafruit_ST7735.cpp:
|
##### If there is a noisy line on one side of the screen, then in Adafruit_ST7735.cpp:
|
||||||
````c++
|
````c++
|
||||||
// Black tab, change MADCTL color filter
|
// Black tab, change MADCTL color filter
|
||||||
if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
|
if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define VERSION "0.4.251"
|
#define VERSION "0.4.255"
|
||||||
|
|
||||||
/* DISPLAY MODEL
|
/* DISPLAY MODEL
|
||||||
* 0 - DUMMY
|
* 0 - DUMMY
|
||||||
@@ -59,7 +59,12 @@
|
|||||||
/*
|
/*
|
||||||
* ESP DEVBOARD
|
* ESP DEVBOARD
|
||||||
*/
|
*/
|
||||||
#define LED_BUILTIN 2
|
#define LED_BUILTIN 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other settings. You can overwrite them in the myoptions.h file
|
||||||
|
*/
|
||||||
|
#define TFT_ROTATE 3 // display rotation. 3 - 180 degress
|
||||||
|
|
||||||
#if __has_include("myoptions.h")
|
#if __has_include("myoptions.h")
|
||||||
#include "myoptions.h"
|
#include "myoptions.h"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "audioVS1053Ex.h"
|
#include "audioVS1053Ex.h"
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
AudioBuffer::AudioBuffer(size_t maxBlockSize) {
|
AudioBuffer::AudioBuffer(size_t maxBlockSize) {
|
||||||
// if maxBlockSize isn't set use defaultspace (1600 bytes) is enough for aac and mp3 player
|
// if maxBlockSize isn't set use defaultspace (1600 bytes) is enough for aac and mp3 player
|
||||||
@@ -349,26 +350,32 @@ size_t Audio::bufferFree(){
|
|||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void Audio::setVolume(uint8_t vol){
|
void Audio::setVolume(uint8_t vol){
|
||||||
|
|
||||||
// Set volume. Both left and right.
|
// Set volume. Both left and right.
|
||||||
// Input value is 0..21. 21 is the loudest.
|
// Input value is 0..254. 254 is the loudest.
|
||||||
// Clicking reduced by using 0xf8 to 0x00 as limits.
|
// Clicking reduced by using 0xf8 to 0x00 as limits.
|
||||||
uint16_t value; // Value to send to SCI_VOL
|
uint16_t value; // Value to send to SCI_VOL
|
||||||
|
uint8_t valueL, valueR;
|
||||||
//if(vol > 21) vol=21;
|
int16_t balance_map = map(m_balance, -16, 16, -100, 100);
|
||||||
//uint8_t vol2 = map(vol, 0, 254, 128, 254);
|
|
||||||
//uint8_t vol2 = log((float)vol)*23+128;
|
valueL = vol;
|
||||||
//uint8_t vol2 = log10((float)vol)*50.0+128;
|
valueR = vol;
|
||||||
uint8_t lgvol = log10(((float)vol+1)) * 50.54571334 + 128;
|
if (balance_map < 0) {
|
||||||
//uint8_t vol2 = sqrt((float)vol)*7.5+128;
|
valueR = (float)valueR-(float)valueR * abs((float)balance_map)/100;
|
||||||
if(vol != curvol){
|
} else if (balance_map > 0) {
|
||||||
curvol = vol; // #20
|
valueL = (float)valueL-(float)valueL * abs((float)balance_map)/100;
|
||||||
//vol=volumetable[vol]; // Save for later use
|
|
||||||
value=map(lgvol, 0, 254, 0xF8, 0x00); // 0..100% to one channel
|
|
||||||
value=(value << 8) | value;
|
|
||||||
|
|
||||||
write_register(SCI_VOL, value); // Volume left and right
|
|
||||||
}
|
}
|
||||||
|
curvol = vol;
|
||||||
|
|
||||||
|
//uint8_t lgvolL = log10(((float)valueL+1)) * 64.54571334 + 96;
|
||||||
|
//uint8_t lgvolR = log10(((float)valueR+1)) * 64.54571334 + 96;
|
||||||
|
uint8_t lgvolL = VS1053VOL(valueL);
|
||||||
|
uint8_t lgvolR = VS1053VOL(valueR);
|
||||||
|
if(lgvolL==VS1053VOLM) lgvolL=0;
|
||||||
|
if(lgvolR==VS1053VOLM) lgvolR=0;
|
||||||
|
valueL=map(lgvolL, 0, 254, 0xF8, 0x00);
|
||||||
|
valueR=map(lgvolR, 0, 254, 0xF8, 0x00);
|
||||||
|
value=(valueL << 8) | valueR;
|
||||||
|
write_register(SCI_VOL, value);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void Audio::setTone(uint8_t *rtone){ // Set bass/treble (4 nibbles)
|
void Audio::setTone(uint8_t *rtone){ // Set bass/treble (4 nibbles)
|
||||||
@@ -383,11 +390,24 @@ void Audio::setTone(uint8_t *rtone){ // Set bass/treble (4
|
|||||||
}
|
}
|
||||||
write_register(SCI_BASS, value); // Volume left and right
|
write_register(SCI_BASS, value); // Volume left and right
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Name Bits Description
|
||||||
|
ST AMPLITUDE 15:12 Treble Control in 1.5 dB steps (-8..7, 0 = off)
|
||||||
|
ST FREQLIMIT 11:8 Lower limit frequency in 1000 Hz steps (1..15) // 1000..15000
|
||||||
|
SB AMPLITUDE 7:4 Bass Enhancement in 1 dB steps (0..15, 0 = off)
|
||||||
|
SB FREQLIMIT 3:0 Lower limit frequency in 10 Hz steps (2..15) // 20..150
|
||||||
|
*/
|
||||||
void Audio::setTone(int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass){
|
void Audio::setTone(int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass){
|
||||||
// TODO
|
if(gainLowPass<0) gainLowPass=0;
|
||||||
|
if(gainLowPass>15) gainLowPass=15;
|
||||||
|
if(gainBandPass<0) gainBandPass=0;
|
||||||
|
if(gainBandPass>13) gainBandPass=13;
|
||||||
|
uint8_t rtone[] = {map(gainHighPass, -16, 16, -8, 7), 2+gainBandPass, gainLowPass, 15-gainBandPass};
|
||||||
|
setTone(rtone);
|
||||||
}
|
}
|
||||||
void Audio::setBalance(int8_t bal){
|
void Audio::setBalance(int8_t bal){
|
||||||
// TODO
|
m_balance = bal;
|
||||||
|
setVolume(curvol);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
uint8_t Audio::getVolume() // Get the currenet volume setting.
|
uint8_t Audio::getVolume() // Get the currenet volume setting.
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
#define AUDIOBUFFER_MULTIPLIER 13
|
#define AUDIOBUFFER_MULTIPLIER 13
|
||||||
|
|
||||||
|
#define VS1053VOLM 128 // 128 or 96 only
|
||||||
|
#define VS1053VOL(v) (VS1053VOLM==128?log10(((float)v+1)) * 50.54571334 + 128:log10(((float)v+1)) * 64.54571334 + 96)
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "libb64/cencode.h"
|
#include "libb64/cencode.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
@@ -128,6 +131,7 @@ private:
|
|||||||
uint8_t curvol ; // Current volume setting 0..100%
|
uint8_t curvol ; // Current volume setting 0..100%
|
||||||
|
|
||||||
const uint8_t vs1053_chunk_size = 32 ;
|
const uint8_t vs1053_chunk_size = 32 ;
|
||||||
|
int8_t m_balance = 0; // -16 (mute left) ... +16 (mute right)
|
||||||
// SCI Register
|
// SCI Register
|
||||||
const uint8_t SCI_MODE = 0x0 ;
|
const uint8_t SCI_MODE = 0x0 ;
|
||||||
const uint8_t SCI_STATUS = 0x1 ;
|
const uint8_t SCI_STATUS = 0x1 ;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
#define TFT_ROTATE 3
|
|
||||||
#define TFT_LINEHGHT 10
|
#define TFT_LINEHGHT 10
|
||||||
#define TFT_FRAMEWDT 4
|
#define TFT_FRAMEWDT 4
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "fonts/TinyFont6.h"
|
#include "fonts/TinyFont6.h"
|
||||||
#include "fonts/DS_DIGI15pt7b.h"
|
#include "fonts/DS_DIGI15pt7b.h"
|
||||||
|
|
||||||
#define TFT_ROTATE 0
|
|
||||||
#define TFT_LINEHGHT 8
|
#define TFT_LINEHGHT 8
|
||||||
#define TFT_FRAMEWDT 0
|
#define TFT_FRAMEWDT 0
|
||||||
#define TFT_CONTRAST 55
|
#define TFT_CONTRAST 55
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
|
|
||||||
#define TFT_ROTATE 0
|
|
||||||
#define TFT_LINEHGHT 8
|
#define TFT_LINEHGHT 8
|
||||||
#define TFT_FRAMEWDT 0
|
#define TFT_FRAMEWDT 0
|
||||||
|
|
||||||
|
|||||||
@@ -8,20 +8,6 @@
|
|||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#include "../../network.h"
|
#include "../../network.h"
|
||||||
|
|
||||||
#define DTYPE INITR_BLACKTAB // 1.8' https://aliexpress.ru/item/1005002822797745.html
|
|
||||||
/* If there is a noisy line on one side of the screen, then in Adafruit_ST7735.cpp:
|
|
||||||
|
|
||||||
// Black tab, change MADCTL color filter
|
|
||||||
if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
|
|
||||||
uint8_t data = 0xC0;
|
|
||||||
sendCommand(ST77XX_MADCTL, &data, 1);
|
|
||||||
_add this_ -> _colstart = 2;
|
|
||||||
_add this_ -> _rowstart = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
//#define DTYPE INITR_144GREENTAB // 1.44' https://aliexpress.ru/item/1005002822797745.html
|
|
||||||
|
|
||||||
class GFXClock {
|
class GFXClock {
|
||||||
public:
|
public:
|
||||||
GFXClock() {};
|
GFXClock() {};
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <Adafruit_ST7735.h>
|
#include <Adafruit_ST7735.h>
|
||||||
#include "fonts/DS_DIGI28pt7b.h"
|
#include "fonts/DS_DIGI28pt7b.h"
|
||||||
|
|
||||||
#define TFT_ROTATE 3
|
|
||||||
#define TFT_LINEHGHT 10
|
#define TFT_LINEHGHT 10
|
||||||
#define TFT_FRAMEWDT 4
|
#define TFT_FRAMEWDT 4
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user