Skip to content

Conversation

@nihinihikun
Copy link
Contributor

以下確認して消してからプルリク出してください

概要

  • E220のcanとの統合

ここまで

ここまではpayloadがちゃんと受信できるかの確認.CAN→payload用の配列にいれるところは一切実機テストしてない

@nihinihikun nihinihikun requested a review from 771-8bit March 15, 2024 15:40
@nihinihikun nihinihikun self-assigned this Mar 15, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

cpplint

test/E220_vertual_rocket/E220_vertual_rocket.ino|81| Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

static bool send_allowed = false;//送信許可
static bool payload_semapho = false;//payloadの生成が終わるまで送信を許可しない
static uint32_t latest_send_time = 0;//最後に送信した時間
GeneratePayload(tx_payload,payload_semapho);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

}
}

void GeneratePayload(byte* tx_payload,bool _payload_semapho){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]


switch (CCP.id) {
case CCP_nose_status:
if(CCP.str_match("OK",2)){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

case CCP_nose_status:
if(CCP.str_match("OK",2)){
status_byte|=0b10000000;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

}
break;
case CCP_surface_pressure1_status:
if(CCP.str_match("OK",2)){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

}else{
Serial.println("");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Redundant blank line at the end of a code block should be deleted. [whitespace/blank_line] [3]

static bool send_allowed = false;//送信許可
static bool payload_semapho = false;//payloadの生成が終わるまで送信を許可しない
static uint32_t latest_send_time = 0;//最後に送信した時間
GeneratePayload(tx_payload,payload_semapho);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

}
}

void GeneratePayload(byte* tx_payload,bool _payload_semapho){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

tx_payload[12] = buf.b[1];
tx_payload[13] = buf.b[2];
tx_payload[14] = buf.b[3];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

tx_payload[20] = buf.b[1];
tx_payload[21] = buf.b[2];
tx_payload[22] = buf.b[3];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

@nihinihikun
Copy link
Contributor Author

ソフトってこんな感じでいいの?test/E220_can.inoがロケット側,test/E220_ground.inoが地上局側.

@nihinihikun
Copy link
Contributor Author

Nose/Nose.inoは別のブランチでいろいろ修正済みなのでこのブランチではむししてもらってかまわん

@771-8bit
Copy link
Member

CANが繋がったXIAO RP2040のMissionInterfaceと,E220が繋がったラズピコのMainそれぞれ書いてほしい.

MIFは電源のONOFFとかも管理してて,Main→MIFのUARTはアップリンクの文字列,MIF→MainのUARTはそのままパススルーしてE220に繋げるとかがいいと思う(E220からのレスポンス受け取る必要あるなら大変だけど)

https://github.com/core-rocket/24th-ise/blob/837d332fb67b22d7dbe3abd70689ffa748867726/MissionInterface/MissionInterface.ino#L40C1-L45C6

static bool payload_semapho = false; //payloadの生成が終わるまで送信を許可しない
static uint32_t latest_send_time = 0; //最後に送信した時間
GeneratePayload(tx_payload, payload_semapho);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

GeneratePayload(tx_payload, payload_semapho);

//ToDO:tx_payloadをMain基板に送信する処理を書く

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

GeneratePayload(tx_payload, payload_semapho);

//ToDO:tx_payloadをMain基板に送信する処理を書く

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Redundant blank line at the end of a code block should be deleted. [whitespace/blank_line] [3]

static bool send_allowed = false; //送信許可
static uint32_t latest_send_time = 0; //最後に送信した時間

//TODO:ここにMIF基板からのデータを受け取ってtx_payloadにいれる処理を書く

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2]

static bool send_allowed = false; //送信許可
static uint32_t latest_send_time = 0; //最後に送信した時間

//TODO:ここにMIF基板からのデータを受け取ってtx_payloadにいれる処理を書く

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
TODO(my_username) should be followed by a space [whitespace/todo] [2]

static uint32_t latest_send_time = 0; //最後に送信した時間

//TODO:ここにMIF基板からのデータを受け取ってtx_payloadにいれる処理を書く

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

Serial.println(surface5_pressure.f, 6);
Serial.print(",");
Serial.println(surface6_pressure.f, 6);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

Serial.print(",");
Serial.println(surface6_pressure.f, 6);
}
} No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Could not find a newline character at the end of the file. [whitespace/ending_newline] [5]

static byte rx_payload[199] = { 0 };
int rssi = 0;
int Rxlength = 0;
Rxlength = e220.ReceiveDataVariebleLength(rx_payload,47,&rssi);//surface6_pressureまでの長さ

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

}
if (send_allowed == true && payload_semapho == false) {
Serial.println("send!");
e220.TransmissionDataVariebleLength(tx_payload,47);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

Serial.println(surface5_pressure.f, 6);
Serial.print(",");
Serial.println(surface6_pressure.f, 6);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

Serial.print(",");
Serial.println(surface6_pressure.f, 6);
}
} No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Could not find a newline character at the end of the file. [whitespace/ending_newline] [5]

@nihinihikun
Copy link
Contributor Author

@771-8bit こういう感じでいかが?
test/MIFE220/MainE220/MainE220.ino
test/MIFE220/MIFcan/MIFcan.ino
軽くみてみて

@771-8bit
Copy link
Member

イメージ通りだったので結構良さそう
ToDoのところこのまま追加お願い


#define SEND_PERIOD_MS 1000

E220 e220(Serial1,0xFF, 0xFF, 0x00); //TARGETADRESS=0xFFFF,CHANNEL=0x00

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]


#define SEND_PERIOD_MS 1000

E220 e220(Serial1,0xFF, 0xFF, 0x0A); //TARGETADRESS=0xFFFF,CHANNEL=0x0A=10ch=ARIB 34-35

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]


#define SEND_PERIOD_MS 1000

E220 e220(Serial1,0xFF, 0xFF, 0x0A); //TARGETADRESS=0xFFFF,CHANNEL=0x0A=10ch=ARIB 34-35

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

#define PAYLOAD_SIZE 47
#define ROCKET_INSIDE_PACKET_LETTER 0x4E

E220 e220(Serial2,0xFF, 0xFF, 0x0A); //TARGETADRESS=0xFFFF,CHANNEL=0x0A

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

@nihinihikun
Copy link
Contributor Author

どうでしょう.Main基板のSerialはとりあえず1,2にしといた.そこはいい感じにマージしといて. @771-8bit

Copy link
Member

@771-8bit 771-8bit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nihinihikun 見たわよ

static bool comingdata = false; //MIF基板からデータが来ているか

//MIF基板からのデータを受け取ってtx_payloadにいれる処理
if(Serial1.readBytesUntil(ROCKET_INSIDE_PACKET_LETTER,tx_payload,PAYLOAD_SIZE)){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readBytesUntilはデータが来るまで待つ(orタイムアウト)ブロッキング関数だから,Serial.available()で受信バイト数読んでSerial.read()で一文字ずつ読み出して手動で終端判定するプログラムに変えてほしい.

ブロッキング関数でここで処理が止まるとMainだからまずい

static byte tx_payload[199] = { 0 };
static byte rocket_inside_packet[200]={0};
static bool payload_semapho = false; //payloadの生成が終わるまで送信を許可しない
GeneratePayload(tx_payload, payload_semapho);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

payload_semapho ,ポインタ渡しするかグローバルにしないと意味なくない?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

というか割り込みじゃないからセマフォ自体いらなそう

GeneratePayload(tx_payload, payload_semapho);
//tx_payloadをMain基板に送信する処理
if (payload_semapho == false) {
SendMainDataPacket(tx_payload);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これMIF→MainのUARTは爆速大量でデータ送って,Main側でダウンリンク頻度絞ってるってことよね?
Main側の処理がパンクしそうだからMIF側でデータ送信頻度絞ってほしい.

MainのプログラムはSerial_E220.write(SerialMIF.read());だけぐらいの感覚.

CAN系のデータはMIFのFlashに保存できるから大量のデータをMainに送る必要はない.

comingdata = false;
}
//ここから送信処理
if (((millis() - latest_send_time) > SEND_PERIOD_MS) && comingdata) { //前の送信から一定時間経過しているか
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIF側でダウンリンクレート絞ってるからSEND_PERIOD_MSいらないよね?
comingdataがtrueのときにすぐデータ出さないと次のループでcomingdataがfalseになるから消したい

@771-8bit 771-8bit mentioned this pull request Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants