Skip to content

Commit

Permalink
Optimize compiler for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson committed Jan 28, 2025
1 parent f40972c commit 42dc61d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 12 additions & 12 deletions main/TPS546.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ static uint16_t float_2_ulinear16(float value)
int TPS546_init(void)
{
uint8_t data[7];
uint8_t u8_value;
uint16_t u16_value;
uint8_t u8_value = 0;
uint16_t u16_value = 0;
uint8_t read_mfr_revision[4];
int temp;
uint8_t comp_config[5];
Expand Down Expand Up @@ -569,7 +569,7 @@ void TPS546_write_entire_config(void)

int TPS546_get_frequency(void)
{
uint16_t value;
uint16_t value = 0;
int freq;

smb_read_word(PMBUS_FREQUENCY_SWITCH, &value);
Expand All @@ -580,7 +580,7 @@ int TPS546_get_frequency(void)

void TPS546_set_frequency(int newfreq)
{
uint16_t value;
uint16_t value = 0;
//int freq;

ESP_LOGI(TAG, "Writing new frequency: %d", newfreq);
Expand All @@ -595,7 +595,7 @@ void TPS546_set_frequency(int newfreq)

int TPS546_get_temperature(void)
{
uint16_t value;
uint16_t value = 0;
int temp;

smb_read_word(PMBUS_READ_TEMPERATURE_1, &value);
Expand All @@ -605,7 +605,7 @@ int TPS546_get_temperature(void)

float TPS546_get_vin(void)
{
uint16_t u16_value;
uint16_t u16_value = 0;
float vin;

/* Get voltage input (ULINEAR16) */
Expand All @@ -623,7 +623,7 @@ float TPS546_get_vin(void)

float TPS546_get_iout(void)
{
uint16_t u16_value;
uint16_t u16_value = 0;
float iout;

/* Get current output (SLINEAR11) */
Expand All @@ -643,7 +643,7 @@ float TPS546_get_iout(void)

float TPS546_get_vout(void)
{
uint16_t u16_value;
uint16_t u16_value = 0;
float vout;

/* Get voltage output (ULINEAR16) */
Expand All @@ -660,8 +660,8 @@ float TPS546_get_vout(void)
}

void TPS546_print_status(void) {
uint16_t u16_value;
uint8_t u8_value;
uint16_t u16_value = 0;
uint8_t u8_value = 0;

if (smb_read_word(PMBUS_STATUS_WORD, &u16_value) != ESP_OK) {
ESP_LOGE(TAG, "Could not read STATUS_WORD");
Expand Down Expand Up @@ -692,7 +692,7 @@ void TPS546_print_status(void) {
**/
void TPS546_set_vout(float volts)
{
uint16_t value;
uint16_t value = 0;

if (volts == 0) {
/* turn off output */
Expand Down Expand Up @@ -722,7 +722,7 @@ void TPS546_set_vout(float volts)

void TPS546_show_voltage_settings(void)
{
uint16_t u16_value;
uint16_t u16_value = 0;
float f_value;

ESP_LOGI(TAG, "-----------VOLTAGE---------------------");
Expand Down
2 changes: 2 additions & 0 deletions sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_LOG_COLORS=y
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y

0 comments on commit 42dc61d

Please sign in to comment.