Skip to content

Commit

Permalink
Fixed build, moved main.cpp to src/
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensElflein committed Nov 8, 2024
1 parent 18c0e62 commit bdf04ef
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE

# Add sources to executable
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
main.cpp
src/main.cpp
src/globals.cpp
src/heartbeat.c
src/id_eeprom.c
Expand Down
2 changes: 0 additions & 2 deletions src/drivers/gps/ublox_gps_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ void UbxGpsInterface::ProcessUbxPacket(const uint8_t *data, const size_t &size)
// substract class, id and length
if (size - 4 == sizeof(UbxNavPvt)) {
const auto *msg = reinterpret_cast<const UbxNavPvt *>(data + 4);
SEGGER_SYSVIEW_MarkStart(1);
HandleNavPvt(msg);
SEGGER_SYSVIEW_MarkStop(1);
} else {
ULOG_WARNING("size mismatch for PVT message!");
}
Expand Down
34 changes: 0 additions & 34 deletions main.cpp → src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,6 @@ MowerService mower_service{3};
ImuService imu_service{4};
PowerService power_service{5};

xbot::driver::gps::UbxGpsInterface gps{};

THD_WORKING_AREA(testWa, 100);
void testThreadFunc(void* arg) {
(void)arg;
while(1) {
auto start = chVTGetSystemTime();
while(chVTTimeElapsedSinceX(start) < TIME_MS2I(100)) {

}
chThdYield();
}
}


int i = 0;
void gpsUpdated(const xbot::driver::gps::GpsDriver::GpsState &new_state) {
(void)new_state;
etl::string<100> lat{};
etl::format_spec format{};
format.width(8).fill(' ').precision(3);
lat += "lat:";
etl::to_string(new_state.pos_lat, lat, format, true);
lat += "lon:";
etl::to_string(new_state.pos_lon, lat, format, true);

SEGGER_RTT_printf(0, "got data: %s!\n", lat.c_str());
i++;
}
/*
* Application entry point.
*/
Expand Down Expand Up @@ -124,11 +95,6 @@ int main(void) {
diff_drive.start();
mower_service.start();

// chThdCreateStatic(testWa, sizeof(testWa), NORMALPRIO, testThreadFunc, NULL);
gps.SetStateCallback(etl::delegate<void(const xbot::driver::gps::GpsDriver::GpsState &new_state)>::create<gpsUpdated>());
gps.SetDatum(49.0, 10.0, 150);
gps.StartDriver(&UARTD6, 921600);

// Subscribe to global events and dispatch to our services
event_listener_t event_listener;
chEvtRegister(&mower_events, &event_listener, 1);
Expand Down

0 comments on commit bdf04ef

Please sign in to comment.