Skip to content

overall charging board fixes#7

Open
Lucifersan wants to merge 19 commits intomasterfrom
payload-fixes
Open

overall charging board fixes#7
Lucifersan wants to merge 19 commits intomasterfrom
payload-fixes

Conversation

@Lucifersan
Copy link
Copy Markdown
Contributor

battery voltage now sends regardless of error
payload and airbrakes now send 5v/13v current messages
LEDs now depend on the real state of the charging/5v/motor pins not if the board received can messages
red LED is ALWAYS charging
blue LED is 5v output on charging_can and motor power on the motor boards
battery charging is no longer set false during the initialization sequence in main.c (its redundant as its already initialized off during pin initialization)

…harging payload and airbrakes also send 5v/13v current messages from airbrake/payload
Comment thread main.c
@@ -1,5 +1,5 @@
#include <xc.h>
#include "canlib.h"
#include "canlib/canlib.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

like i think i said in the slack thread, idk my computer just has this weird issue. probably a config file thing. but this is how i've chosen to fix it and im tired of keeping 2 versions of the code with and without the canlib/canlib.h thing

Comment thread main.c
const uint32_t BOOST_LENGTH_MS = 1000; // for the purposes of debugging
const uint32_t COAST_LENGTH_MS = 2000000; // see above
const uint32_t BOOST_LENGTH_MS = 9000;
const uint32_t COAST_LENGTH_MS = 35000-9000;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like this should be 35000 - BOOST_LENGTH_MS

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

true i thought abt doing that dunno why i didnt

Comment thread main.c
#endif

#if (BOARD_UNIQUE_ID == BOARD_ID_CHARGING_AIRBRAKE)
//suspicious lmao
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it actually sussy still?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well we tested it and it works so not sussy anymore?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This and the other notes about code comments were mostly rhetorical. Probably could have communicated that better. Anyway, this and all the other comments that are out of date/not relevant should be removed.

ADRPT = 0x00;
// ADPCH ANC4;
ADPCH = 0b010100;//x00;
ADPCH = 0b111111;//0b010100;//x00;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wtf is happening here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

adc settings shit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i could change that back but i dont think it makes a real difference

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think its fine if you don't comment the lines, but then get rid of the commented-out code

typedef uint16_t adc_result_t;
#ifndef int24_t
typedef signed short long int int24_t;
//typedef signed long int int24_t;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what made it necessary to change the mcc file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

issues with compiling

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

and int24_t more or less doesnt seem to be used anywhere that we care about so it wasnt worth trying to save it

Copy link
Copy Markdown
Contributor

@Joe-Joe-Joe-Joe Joe-Joe-Joe-Joe Aug 8, 2024

Choose a reason for hiding this comment

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

issues with compiling

Would be nice to solve the root cause. Like, what's the actual error? Did you google it?

Comment thread pwm.c
uint32_t bitWrite = (uint32_t) ((pulseWidth_us * 48) / 128); //48 is Fosc in MHz, 128 is prescaler
//write PW/(Tosc * prescale value)
CCPR3L = bitWrite & 0xFF;
CCPR3H = (bitWrite >> 8) & 0x03; //honestly not sure abt this either this is like a very rough guess but as long as the servo wiggles its fine
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are you sure about it now?

Copy link
Copy Markdown
Contributor Author

@Lucifersan Lucifersan Aug 7, 2024

Choose a reason for hiding this comment

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

yes it clearly works. i wasnt sure about it like 4 months ago when i first wrote this code

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