Skip to content

Commit

Permalink
Merge branch 'CY_V2.0.2_imaxb6_ori_increase_watt'
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
  • Loading branch information
ChihYing_Lin authored and ChihYing_Lin committed May 11, 2017
2 parents 137a31d + 72fd2e6 commit 1b86238
Show file tree
Hide file tree
Showing 16 changed files with 171 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ CMakeFiles/
Makefile
cmake_install.cmake
src/core/Version.h
build_ubuntu.sh
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cheali-charger.*
1 change: 1 addition & 0 deletions src/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Version.h
4 changes: 2 additions & 2 deletions src/core/ProgramData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ uint16_t ProgramData::getMaxIc()
}
#endif

AnalogInputs::ValueType i = AnalogInputs::evalI(MAX_CHARGE_P, v);
AnalogInputs::ValueType i = AnalogInputs::evalI(settings.maxPc, v);

if(i > settings.maxIc)
i = settings.maxIc;
Expand All @@ -174,7 +174,7 @@ uint16_t ProgramData::getMaxIc()
uint16_t ProgramData::getMaxId()
{
AnalogInputs::ValueType v = getDefaultVoltage(VDischarged);
AnalogInputs::ValueType i = AnalogInputs::evalI(MAX_DISCHARGE_P, v);
AnalogInputs::ValueType i = AnalogInputs::evalI(settings.maxPd, v);

if(i > settings.maxId)
i = settings.maxId;
Expand Down
13 changes: 13 additions & 0 deletions src/core/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
#define SETTINGS_MAX_DISCHARGE_I MAX_DISCHARGE_I
#endif

#ifndef SETTINGS_MAX_CHARGE_P
#define SETTINGS_MAX_CHARGE_P MAX_CHARGE_P
#endif

#ifndef SETTINGS_MAX_DISCHARGE_P
#define SETTINGS_MAX_DISCHARGE_P MAX_DISCHARGE_P
#endif



Settings settings;

Expand All @@ -53,6 +62,10 @@ const Settings defaultSettings PROGMEM = {
SETTINGS_MAX_CHARGE_I, //maxIc
ANALOG_AMP(0.050), //minId
SETTINGS_MAX_DISCHARGE_I, //maxId

SETTINGS_MAX_CHARGE_P, //maxPc
SETTINGS_MAX_DISCHARGE_P, //maxPd

ANALOG_VOLT(10.000),//inputVoltageLow

SETTINGS_ADC_NOISE_DEFAULT, //adcNoise
Expand Down
3 changes: 3 additions & 0 deletions src/core/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ struct Settings {
AnalogInputs::ValueType minId;
AnalogInputs::ValueType maxId;

AnalogInputs::ValueType maxPc;
AnalogInputs::ValueType maxPd;

AnalogInputs::ValueType inputVoltageLow;
uint16_t adcNoise;
uint16_t UART;
Expand Down
1 change: 1 addition & 0 deletions src/core/drivers/cprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define CP_TYPE_MINUTES CP_TYPE_ANALOG(AnalogInputs::Minutes)
#define CP_TYPE_PROCENTAGE CP_TYPE_ANALOG(AnalogInputs::Procent)
#define CP_TYPE_A CP_TYPE_ANALOG(AnalogInputs::Current)
#define CP_TYPE_W CP_TYPE_ANALOG(AnalogInputs::Power)
#define CP_TYPE_TEMP_MINUT CP_TYPE_ANALOG(AnalogInputs::TemperatureMinutes)
#define CP_TYPE_CHARGE CP_TYPE_ANALOG(AnalogInputs::Charge)
#define CP_TYPE_CHARGE_TIME CP_TYPE_ANALOG(AnalogInputs::TimeLimitMinutes)
Expand Down
4 changes: 3 additions & 1 deletion src/core/menus/SettingsMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ const EditMenu::StaticEditData editData[] PROGMEM = {
{string_AudioBeep, COND_ALWAYS, SETTING(ON_OFF, audioBeep), {1, 0, 1}},
{string_minIc, COND_ALWAYS, SETTING(A, minIc), {CE_STEP_TYPE_KEY_SPEED, ANALOG_AMP(0.001), ANALOG_AMP(0.500)}},
{string_maxIc, COND_ALWAYS, SETTING(A, maxIc), {CE_STEP_TYPE_SMART, ANALOG_AMP(0.001), MAX_CHARGE_I}},
{string_maxPc, COND_ALWAYS, SETTING(W, maxPc), {CE_STEP_TYPE_SMART, ANALOG_WATT(0.1), MAX_CHARGE_P}},
{string_minId, COND_ALWAYS, SETTING(A, minId), {CE_STEP_TYPE_KEY_SPEED, ANALOG_AMP(0.001), ANALOG_AMP(0.500)}},
{string_maxId, COND_ALWAYS, SETTING(A, maxId), {CE_STEP_TYPE_SMART, ANALOG_AMP(0.001), MAX_DISCHARGE_I}},
{string_inputLow, COND_ALWAYS, SETTING_N(V, 3, inputVoltageLow), {ANALOG_VOLT(1), ANALOG_VOLT(7), ANALOG_VOLT(30)}},
{string_maxPd, COND_ALWAYS, SETTING(W, maxPd), {CE_STEP_TYPE_SMART, ANALOG_WATT(0.1), MAX_DISCHARGE_P}},
{string_inputLow, COND_ALWAYS, SETTING(V, inputVoltageLow), {ANALOG_VOLT(0.1), ANALOG_VOLT(7), ANALOG_VOLT(30)}},
#ifdef ENABLE_ANALOG_INPUTS_ADC_NOISE
{string_adcNoise, COND_ALWAYS, SETTING(ON_OFF, adcNoise), {1, 0, 1}},
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/core/strategy/SMPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace SMPS {
}
#endif

AnalogInputs::ValueType i = AnalogInputs::evalI(MAX_CHARGE_P, v);
AnalogInputs::ValueType i = AnalogInputs::evalI(settings.maxPc, v);
if(i > settings.maxIc)
i = settings.maxIc;
return i;
Expand Down
4 changes: 3 additions & 1 deletion src/core/strings/standard.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ namespace SettingsMenu {
STRING(maxIc, "max Ic:");
STRING(minId, "min Id:");
STRING(maxId, "max Id:");
STRING(inputLow, "input low: ");
STRING(maxPc, "max Pc:");
STRING(maxPd, "max Pd:");
STRING(inputLow, "input low:");
STRING(adcNoise, "adc noise:");
STRING(UARTview, "UART:");
STRING(UARTspeed, "|speed:");
Expand Down
8 changes: 8 additions & 0 deletions src/hardware/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.cmake
*.bin
*.hex
*.eep
*.size
Makefile
CMakeFiles
cheali-charger-*atmega32
1 change: 1 addition & 0 deletions src/hardware/atmega32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ add_subdirectory(targets/Bantam-BC6HP-250W)
add_subdirectory(targets/Turnigy-Accucel-8-150W-7A)
add_subdirectory(targets/GTPowerA6-10-original)
add_subdirectory(targets/imaxB6-original)
add_subdirectory(targets/imaxB6-original-chihying)
add_subdirectory(targets/Turnigy-Accucel-6-50W-5A)
add_subdirectory(targets/Turnigy-Accucel-6-50W-6A)
add_subdirectory(targets/Turnigy-MEGA-400Wx2)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

set(SOURCE_FILES
defaultCalibration.cpp
HardwareConfig.h
)

CHEALI_HARDWARE(imaxB6-original-chihying)
CHEALI_CPU(atmega32)
CHEALI_GENERIC_CHARGER(50W)

CHEALI_GENERATE_AVR_EXEC()
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
cheali-charger - open source firmware for a variety of LiPo chargers
Copyright (C) 2013 Paweł Stawicki. All right reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HARDWARE_CONFIG_H_
#define HARDWARE_CONFIG_H_

#include "GlobalConfig.h"
#include "HardwareConfigGeneric.h"
#include "imaxB6-pins.h"

#define MAX_CHARGE_V ANALOG_VOLT(27.000)
#define MAX_CHARGE_I ANALOG_AMP(10.000)
#define MAX_CHARGE_P ANALOG_WATT(80.000)

#define MAX_DISCHARGE_P ANALOG_WATT(8.000)
#define MAX_DISCHARGE_I ANALOG_AMP(2.000)

//default value in settings
#define SETTINGS_MAX_CHARGE_I ANALOG_AMP(5.000)
#define SETTINGS_MAX_DISCHARGE_I ANALOG_AMP(1.000)
#define SETTINGS_MAX_CHARGE_P ANALOG_WATT(50.000)
#define SETTINGS_MAX_DISCHARGE_P ANALOG_WATT(5.000)

#define SMPS_UPPERBOUND_VALUE 65000
#define DISCHARGER_UPPERBOUND_VALUE TIMER1_PRECISION_PERIOD


#endif /* HARDWARE_CONFIG_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
cheali-charger - open source firmware for a variety of LiPo chargers
Copyright (C) 2013 Paweł Stawicki. All right reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "AnalogInputsPrivate.h"
#include "memory.h"

const AnalogInputs::DefaultValues AnalogInputs::inputsP_[AnalogInputs::PHYSICAL_INPUTS] PROGMEM = {
{{0, 0}, {55102, 25141}}, //Vout
{{0, 0}, {26613, 12518}}, //VreversePolarity
{{775, 50}, {11080, 1000}}, //Ismps
{{2017, 50}, {11971, 300}}, //Idischarge

{{0, 0}, {0, 0}}, //VoutMux
{{0, 0}, {0, 0}}, //Tintern
{{0, 0}, {48061, 14047}}, //Vin
{{5884, 2280}, {0, 0}}, //Textern

{{0, 0}, {48963, 3752}}, //Vb0_pin
{{0, 0}, {55048, 4187}}, //Vb1_pin
{{0, 0}, {56248, 8378}}, //Vb2_pin
{{0, 0}, {56067, 4191}}, //Vb3_pin

{{0, 0}, {54784, 4193}}, //Vb4_pin
{{0, 0}, {55070, 4196}}, //Vb5_pin
{{0, 0}, {55808, 4193}}, //Vb6_pin

#if MAX_BANANCE_CELLS > 6
{{0, 0}, {50752, ANALOG_VOLT(3.865)}}, //Vb7_pin
{{0, 0}, {51008, ANALOG_VOLT(3.885)}}, //Vb8_pin
#endif
//1-1 correlation
{{780, 50}, {11080, 1000}}, //IsmpsSet
{{730, 50}, {4410, 300}}, //IdischargeSet
};


Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -x

#maybe you should change this:
#TTY=-P/dev/ttyUSB0
TTY=
PROGRAMMER=usbasp
#---

PARTNO=atmega32

HEX=`ls *.hex | head -1`
echo "HEX=$HEX"
echo "TTY=$TTY"

if [ "$1" != "--no-backup" ]; then
NOW=`date +"%F_%T"`
DIR="backup/$NOW"
echo "creating buckup: $DIR"
mkdir -p $DIR
cd $DIR
avrdude -p$PARTNO -c$PROGRAMMER $TTY -Uflash:r:flash.bin:r -Ulfuse:r:lfuse.bin:r -Uhfuse:r:hfuse.bin:r -Ueeprom:r:eeprom.bin:r
cd -
fi

if [ -f "$HEX" ]; then
avrdude -p$PARTNO -c$PROGRAMMER $TTY -Uflash:w:$HEX:a
fi

0 comments on commit 1b86238

Please sign in to comment.