Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Main.ino #20

Closed
wants to merge 17 commits into from
Closed

Update Main.ino #20

wants to merge 17 commits into from

Conversation

maruyama0630
Copy link
Contributor

100Hz処理でくくって、BME280も追加しました。

概要

mainコード(改良&BME追加)

背景

変更範囲

BMEを追加して、100Hz処理を分割しました。結構全体的に改善しました。

100Hz処理でくくって、BME280も追加しました。
Main/Main.ino Outdated
int phase_now = 0; //現在のフェーズを区別(0=CHEAK,1=READY,2=FLIGHT,3=OPENED)
int Openjudge = 1; //開放禁止コマンド用状態表示用(0=NOT_OPEN,1=OPEN)
double BNO[10]; //BNOデータ取得、格納に用いる
unsigned long time_data = 0; //離床判定タイマー(燃焼終了検知)
Copy link

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

Main/Main.ino Outdated
#include<Adafruit_BME280.h>
//1013.25は地球の海面上の大気圧の平均値(1気圧)です。
#define SEALEVELPRESSURE_HPA (1013.25)

Copy link

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]

Main/Main.ino Outdated
#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;
unsigned long delayTime;
Copy link

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]

Main/Main.ino Outdated
#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;
unsigned long delayTime;
Copy link

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

Main/Main.ino Outdated

Adafruit_BME280 bme;
unsigned long delayTime;

Copy link

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]

Main/Main.ino Outdated
status = bme.begin(0x76);
if (!status) {
Serial.println("BME280 sensor");
while (10);
Copy link

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Empty loop bodies should use {} or continue [whitespace/empty_loop_body] [5]

Main/Main.ino Outdated
}

// loop()と,ここから呼び出される関数ではdelay()使用禁止
void loop() {

Copy link

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 start of a code block should be deleted. [whitespace/blank_line] [2]

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

Main/0317mainprogram/utility/imumaths.h|28| Include the directory when naming header files [build/include_subdir] [4]
Main/0317mainprogram/utility/imumaths.h|29| Include the directory when naming header files [build/include_subdir] [4]
Main/0317mainprogram/utility/matrix.h|30| Include the directory when naming header files [build/include_subdir] [4]
Main/0317mainprogram/utility/quaternion.h|32| Include the directory when naming header files [build/include_subdir] [4]
Main/0317mainprogram/utility/quaternion.h|107| Is this a non-const reference? If so, make const or use a pointer: Vector<3> &axis [runtime/references] [2]
Main/0317mainprogram/utility/quaternion.h|107| Is this a non-const reference? If so, make const or use a pointer: double &angle [runtime/references] [2]
Main/0317mainprogram/utility/vector.h|37| Single-parameter constructors should be marked explicit. [runtime/explicit] [5]
Main/Main.ino|61| Use int16/int64/etc, rather than the C type long [runtime/int] [4]
Main/Main.ino|79| Use int16/int64/etc, rather than the C type long [runtime/int] [4]
Main/Main.ino|271| Using C-style cast. Use static_cast(...) instead [readability/casting] [4]


Servo myservo;
const int SV_PIN = 7;
unsigned long time_servo_ms = 0; //servoが閉じるのを時間指定するために用いる

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

int phase_now = 0; //現在のフェーズを区別(0=CHEAK,1=READY,2=FLIGHT,3=OPENED)
int Openjudge = 1; //開放禁止コマンド用状態表示用(0=NOT_OPEN,1=OPEN)
double BNO[10]; //BNOデータ取得、格納に用いる
unsigned long time_data_ms = 0; //離床判定タイマー(燃焼終了検知)

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;
unsigned long delayTime;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

}
}
return;
}

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]

int phase_now = 0; //現在のフェーズを区別(0=CHEAK,1=READY,2=FLIGHT,3=OPENED)
int Openjudge = 1; //開放禁止コマンド用状態表示用(0=NOT_OPEN,1=OPEN)
double BNO[10]; //BNOデータ取得、格納に用いる
unsigned long time_data_ms = 0; //離床判定タイマー(燃焼終了検知)

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

/* 1m/s^2 = 100 LSB */
xyz[0] = ((double)x) / 100.0;
xyz[1] = ((double)y) / 100.0;
xyz[2] = ((double)z) / 100.0;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]


/* Functions to deal with raw calibration data */
bool getSensorOffsets(uint8_t *calibData);
bool getSensorOffsets(adafruit_bno055_offsets_t &offsets_type);

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Is this a non-const reference? If so, make const or use a pointer: adafruit_bno055_offsets_t &offsets_type [runtime/references] [2]

/* Power managments functions */
void enterSuspendMode();
void enterNormalMode();

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]

bool write8(adafruit_bno055_reg_t, byte value);

private:

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Do not leave a blank line after "private:" [whitespace/blank_line] [3]

#ifndef IMUMATH_H
#define IMUMATH_H

#include "matrix.h"

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Include the directory when naming header files [build/include_subdir] [4]

int phase_now = 0; //現在のフェーズを区別(0=CHEAK,1=READY,2=FLIGHT,3=OPENED)
int Openjudge = 1; //開放禁止コマンド用状態表示用(0=NOT_OPEN,1=OPEN)
double BNO[10]; //BNOデータ取得、格納に用いる
unsigned long time_data_ms = 0; //離床判定タイマー(燃焼終了検知)

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

Adafruit_BME280 bme;
const float SEALEVELPRESSURE_HPA = 1013.25;
unsigned long delayTime;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

if (Serial.available()) {
uplink = Serial.readStringUntil('\n');
char c = (char)Serial.read();

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

もろもろの修正
int phase_now = 0; //現在のフェーズを区別(0=CHEAK,1=READY,2=FLIGHT,3=OPENED)
int Openjudge = 1; //開放禁止コマンド用状態表示用(0=NOT_OPEN,1=OPEN)
double BNO[10]; //BNOデータ取得、格納に用いる
unsigned long time_data_ms = 0; //離床判定タイマー(燃焼終了検知)

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;
unsigned long delayTime;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

// Serial.println(downlink);
// }
if (Serial.available()) {
char c = (char)Serial.read();

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]


/* Reset */
write8(BNO055_SYS_TRIGGER_ADDR, 0x20);
/* Delay incrased to 30ms due to power issues https://tinyurl.com/y375z699 */

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Complex multi-line /.../-style comment found. Lint may give bogus warnings. Consider replacing these with //-style comments, with #if 0...#endif, or with more clearly structured multi-line comments. [readability/multiline_comment] [5]

switch (vector_type) {
case VECTOR_MAGNETOMETER:
/* 1uT = 16 LSB */
xyz[0] = ((double)x) / 16.0;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

case VECTOR_MAGNETOMETER:
/* 1uT = 16 LSB */
xyz[0] = ((double)x) / 16.0;
xyz[1] = ((double)y) / 16.0;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

/* 1uT = 16 LSB */
xyz[0] = ((double)x) / 16.0;
xyz[1] = ((double)y) / 16.0;
xyz[2] = ((double)z) / 16.0;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

break;
case VECTOR_GYROSCOPE:
/* 1dps = 16 LSB */
xyz[0] = ((double)x) / 16.0;

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

#include <stdint.h>
#include <string.h>

#include "vector.h"

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Include the directory when naming header files [build/include_subdir] [4]

#include <stdlib.h>
#include <string.h>

#include "matrix.h"

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Include the directory when naming header files [build/include_subdir] [4]

}
}

void toAxisAngle(Vector<3> &axis, double &angle) const {

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Is this a non-const reference? If so, make const or use a pointer: Vector<3> &axis [runtime/references] [2]

}
}

void toAxisAngle(Vector<3> &axis, double &angle) const {

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Is this a non-const reference? If so, make const or use a pointer: double &angle [runtime/references] [2]

public:
Vector() { memset(p_vec, 0, sizeof(double) * N); }

Vector(double a) {

Choose a reason for hiding this comment

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

[cpplint] reported by reviewdog 🐶
Single-parameter constructors should be marked explicit. [runtime/explicit] [5]

@771-8bit
Copy link
Member

動作検証間に合わなかったのでOpener.hでいく
https://github.com/core-rocket/Opener

@771-8bit 771-8bit closed this 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.

2 participants