Skip to content

Commit

Permalink
Merge pull request #82 from MK16kawai/dev
Browse files Browse the repository at this point in the history
fixed some bugs and update thermal&tof app
  • Loading branch information
Neutree authored Jan 6, 2025
2 parents f9f4091 + fe7ff53 commit ef142dd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/comm/src/maix_modbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Slave::~Slave()
::maix::err::Err Slave::__receive__()
{
this->rc_ = ::modbus_receive(this->ctx_.get(), this->query_);
if (this->rc_ >= 0) {
if (this->rc_ > 0) {
if (this->debug_) {
log::info("%s receive, len: %d", this->TAG().c_str(), this->rc_);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ int TMC2209::serialRead()
// auto all_datas = this->_uart->read(buffer+next_index, num, num);
// next_index += num;
// for (int i = 0; i < num; ++i) {

// }
// }

Expand Down Expand Up @@ -995,7 +994,7 @@ uint32_t TMC2209::read(uint8_t register_address)

// if (reply_delay >= REPLY_DELAY_MAX_MICROSECONDS)
// {
// return 0;
// return 0;
// }

// this->serialRead();
Expand Down
5 changes: 3 additions & 2 deletions components/ext_dev/src/tmc2209/maix_tmc2209.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ static constexpr int TRY_NUM = 5;
* speed ==> (360/step_angle)/(screw_pitch/speed) ==> 400 fullsteps/s
* speed_factor ==> speed/SPEED_EACH_FACTOR ==> ((360/step_angle)/(screw_pitch/speed))/SPEED_EACH_FACTOR ==> 555
*/
static inline uint16_t calculate_speed_factor(uint16_t speed_mm_s, float step_angle, uint16_t screw_pitch)
static inline uint16_t calculate_speed_factor(float speed_mm_s, float step_angle, float screw_pitch)
{
return static_cast<uint16_t>(((360/step_angle)/(static_cast<float>(screw_pitch)/speed_mm_s))/SPEED_EACH_FACTOR);
return static_cast<uint16_t>(((360.0f/step_angle)/(screw_pitch/speed_mm_s))/SPEED_EACH_FACTOR);
}

class FileHandler {
Expand Down Expand Up @@ -782,6 +782,7 @@ void ScrewSlide::move(float oft, int speed_mm_s, std::function<bool(float)> call
this->speed_factor_ : \
calculate_speed_factor(static_cast<uint16_t>(speed_mm_s),
this->step_angle, this->screw_pitch);
// maix::log::info("speed factor:%u", speed_factor);
// maix::log::info("std::abs(oft): %0.3f", std::abs(oft));
// maix::log::info("this->micro_step_distance: %0.8f", this->micro_step_distance);
// maix::log::info("std::abs(oft) / this->micro_step_distance: %0.3f", std::abs(oft) / this->micro_step_distance);
Expand Down
6 changes: 4 additions & 2 deletions projects/app_thermal_camera/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Thermal camera


## support list
## Supported List

* mlx90640
[Consult purchase address](https://wiki.sipeed.com/en/store.html)

* PMOD_Thermal32
2 changes: 1 addition & 1 deletion projects/app_thermal_camera/main/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct BoolResult {

BoolResult find_device()
{
std::string suffix = "Support list:\nMLX90640\n\nClicked to exit.";
std::string suffix = "Support list:\nPMOD_Thermal32\n\nClicked to exit.";
BoolResult res;

bool total_flag = false;
Expand Down
6 changes: 4 additions & 2 deletions projects/app_tof_camera/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ToF camera


## support list
## Supported List

* OPNS3031
[Consult purchase address](https://wiki.sipeed.com/en/store.html)

* PMOD_TOF100
2 changes: 1 addition & 1 deletion projects/app_tof_camera/main/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void show_error(display::Display& disp, touchscreen::TouchScreen& ts)
{
ui_total_deinit();
auto img = Image(disp.width(), disp.height());
std::string msg = "Devices Not Found!\nSupport list:\nOPNS3031\n\nClicked to exit.";
std::string msg = "Devices Not Found!\nSupport list:\nPMOD_TOF100\n\nClicked to exit.";
img.draw_string(0, 100, msg);
disp.show(img);
while (!app::need_exit()) {
Expand Down

0 comments on commit ef142dd

Please sign in to comment.