Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 7:a71a15af455c
- Parent:
- 6:802d0aa08b39
diff -r 802d0aa08b39 -r a71a15af455c main.cpp
--- a/main.cpp Fri Apr 09 01:46:08 2021 +0000
+++ b/main.cpp Fri Apr 09 01:52:46 2021 +0000
@@ -117,7 +117,7 @@
cell_asic bms_ic[TOTAL_IC];
-
+/*
void Handler_canSend() {
int Replace1 = 0;
@@ -192,7 +192,8 @@
}
ic_check();
}
-
+*/
+/*
void Handler_canRecieve(){ //canMasterから送信要求が来たとき,データ送信するための関数
if( flag_can ){
if( canSlave.read( msgSlave1 ) ){ //msgに送られたデータが入る
@@ -203,7 +204,7 @@
}
}
}
-
+*/
int main(void)
{
uint32_t user_command;
@@ -211,9 +212,9 @@
pc.baud(115200);
//printf("main()\n\r");
- canSlave.attach(&Handler_canRecieve, CAN::RxIrq); //CAN受信割り込みの設定
- msgSlave1.id = canSlaveID; //CAN送信側(slave)のIDを決定
- msgSlave1.len = 8; //CAN送信側で送るデータのバイト数
+ //canSlave.attach(&Handler_canRecieve, CAN::RxIrq); //CAN受信割り込みの設定
+ //msgSlave1.id = canSlaveID; //CAN送信側(slave)のIDを決定
+ //msgSlave1.len = 8; //CAN送信側で送るデータのバイト数
while(1) {
BAT_MIN = 0;
@@ -230,6 +231,7 @@
//timer.start(); //書き込み時間測定開始
//timer.stop(); //書き込み時間測定終了
//fclose(fp); //ファイルを閉じる
+ /*
if( CANsendOK ) {
CANsendOK = 0;
printf("Data in msgSlave1.data[0] : %d\n\r", msgSlave1.data[0]); //CANで送信したデータをそのまま表示
@@ -242,6 +244,7 @@
printf("Data in msgSlave1.data[7] : %d\n\r", msgSlave1.data[7]); //上に同じ
printf("\n\r");
}
+ */
BAT_safty();
}
}
@@ -335,10 +338,11 @@
check_error(error);
//print_cells(DATALOG_DISABLED);
print_CAN(DATALOG_DISABLED);
+
}
void print_CAN(uint8_t datalog_en){
- /*
+
__disable_irq();
short n =0;
int BAT_SUM = 0; // 0にする
@@ -368,7 +372,7 @@
}
}
}
- /*
+
for (int current_ic = 0 ; current_ic < TOTAL_IC; current_ic++) {
//if (datalog_en == 0) {
@@ -376,10 +380,10 @@
//for(n = 0; n <= 12; n++){
for (int i=0; i < bms_ic[0].ic_reg.cell_channels; i++) {
- //BAT_CELL= bms_ic[current_ic].cells.c_codes[i];
-
+ //BAT_CELL= bms_ic[current_ic].cells.c_codes[i];
//fprintf(fp,"C%d:", i+1);
//fprintf(fp,"%.4f, ",bms_ic[current_ic].cells.c_codes[i]*0.0001);
+
BAT_SUM = bms_ic[current_ic].cells.c_codes[i] + BAT_SUM;
if(bms_ic[current_ic].cells.c_codes[i] > 10000){
@@ -408,7 +412,7 @@
fprintf(fp,"MAX");
fprintf(fp,"%.4f, ",BAT_MAX*0.0001);
fprintf(fp,"BAT_Current,%f\n",BAT_Current);
- */
+
}
void BAT_safty(){