Fixed SE command - when you sent SE,1,0 it would go to 50% power. Now goes to 0% power like it should.

Also added SE power level to FIFO structure so that if we ever have FIFOs more than 1 long in the future, we won't get bit by using a global value for the SE power. (bad Brian)
pull/57/head
Brian Schmalz 2016-08-10 20:19:03 -05:00
rodzic a81decde38
commit 328d47c1d4
16 zmienionych plików z 11072 dodań i 4899 usunięć

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -1,5 +1,5 @@
#
#Tue Aug 09 20:20:10 CDT 2016
#Wed Aug 10 19:27:30 CDT 2016
EBBv13_XC8_with_bootloader.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=e74fb245f49e267d9211c2e0a3ef3961
EBBv13_no_bootloader.languagetoolchain.version=3.47
EBBv13_with_bootloader.languagetoolchain.version=3.47

Wyświetl plik

@ -6,6 +6,8 @@
<group>
<file>file:/D:/Projects/EggBot_GitHub/EBB_firmware/app.X/source/ebb.c</file>
<file>file:/D:/Projects/EggBot_GitHub/EBB_firmware/app.X/source/ebb.h</file>
<file>file:/D:/Projects/EggBot_GitHub/EBB_firmware/app.X/source/UBW.c</file>
<file>file:/D:/Projects/EggBot_GitHub/EBB_firmware/app.X/nbproject/Makefile-EBBv13_with_bootloader.mk</file>
</group>
</open-files>
</project-private>

Wyświetl plik

@ -152,7 +152,7 @@ const rom char st_LFCR[] = {"\r\n"};
#elif defined(BOARD_EBB_V12)
const rom char st_version[] = {"EBBv12 EB Firmware Version 2.2.1\r\n"};
#elif defined(BOARD_EBB_V13_AND_ABOVE)
const rom char st_version[] = {"EBBv13_and_above EB Firmware Version 2.4.1\r\n"};
const rom char st_version[] = {"EBBv13_and_above EB Firmware Version 2.4.2\r\n"};
#elif defined(BOARD_UBW)
const rom char st_version[] = {"UBW EB Firmware Version 2.2.1\r\n"};
#endif
@ -2922,10 +2922,9 @@ void parse_CK_packet()
// Look at the string pointed to by ptr
// There should be a comma where ptr points to upon entry.
// If not, throw a comma error.
// If so, then look for up to three bytes after the
// If so, then look for up to like a ton of bytes after the
// comma for numbers, and put them all into one
// byte (0-255). If the number is greater than 255, then
// thow a range error.
// unsigned long accumulator.
// Advance the pointer to the byte after the last number
// and return.
ExtractReturnType extract_number(

Wyświetl plik

@ -201,6 +201,9 @@
// 2.4.1 08/08/16 - Added new form of SE command, with optional parameter that
// puts SE in motion queue. (issue #51)
// Fixed issue #52 (bug in parameter check in parse_SM_packet())
// 2.4.2 08/10/16 - Fixed bug in SE command that would set engraver to 50% if
// SE,1,0 was used. Also added engraver power to FIFO structure
// for when third SE parameter is 1.
#include <p18cxxx.h>
#include <usart.h>
@ -539,7 +542,7 @@ void high_ISR(void)
if (CurrentCommand.SEState)
{
// Set RB3 to StoredEngraverPower
CCPR1L = StoredEngraverPower >> 2;
CCPR1L = CurrentCommand.SEPower >> 2;
CCP1CON = (CCP1CON & 0b11001111) | ((StoredEngraverPower << 4) & 0b00110000);
}
else
@ -571,6 +574,7 @@ void high_ISR(void)
CommandFIFO[0].ServoChannel = 0;
CommandFIFO[0].ServoRate = 0;
CommandFIFO[0].SEState = 0;
CommandFIFO[0].SEPower = 0;
FIFOEmpty = TRUE;
}
else {
@ -1895,9 +1899,9 @@ void parse_QC_packet(void)
// Set Engraver
// Usage: SE,<state>,<power>,<use_motion_queue><CR>
// <state> is 0 for off and 1 for on (required)
// <power> is 10 bit PWM power level (optional)
// <power> is 10 bit PWM power level (optional). 0 = 0%, 1023 = 100%
// <use_motion_queue> if 1 then put this command in motion queue (optional))
// We boot up with <power> at 1023 (full on)
// We boot up with <power> at 0
// The engraver motor is always assumed to be on RB3
// So our init routine will map ECCP1
//
@ -1912,10 +1916,11 @@ void parse_SE_packet(void)
UINT8 State = 0;
UINT16 Power = 0;
UINT8 SEUseMotionQueue = FALSE;
ExtractReturnType PowerExtract;
// Extract each of the values.
extract_number (kUCHAR, &State, kREQUIRED);
extract_number (kUINT, &Power, kOPTIONAL);
PowerExtract = extract_number (kUINT, &Power, kOPTIONAL);
extract_number (kUCHAR, &SEUseMotionQueue, kOPTIONAL);
// Bail if we got a conversion error
@ -1937,9 +1942,9 @@ void parse_SE_packet(void)
{
SEUseMotionQueue = 1;
}
// Set to %50 if no Power parameter specified, otherwise use parameter
if (Power == 0 && State == 1)
if (State == 1 && PowerExtract == kEXTRACT_MISSING_PARAMETER)
{
StoredEngraverPower = 512;
}
@ -2002,6 +2007,7 @@ void parse_SE_packet(void)
;
// Set up the motion queue command
CommandFIFO[0].SEPower = StoredEngraverPower;
CommandFIFO[0].DelayCounter = 0;
CommandFIFO[0].SEState = State;
CommandFIFO[0].Command = COMMAND_SE;

Wyświetl plik

@ -89,6 +89,7 @@ typedef struct
UINT8 ServoChannel;
UINT16 ServoRate;
UINT8 SEState;
UINT16 SEPower;
} MoveCommandType;
// Define global things that depend on the board type

Wyświetl plik

@ -1,5 +1,5 @@
MPLINK 5.00, LINKER
Linker Map File - Created Mon Aug 08 00:31:51 2016
Linker Map File - Created Wed Aug 10 19:59:56 2016
Section Info
Section Type Address Location Size(Bytes)

Wyświetl plik

@ -1,5 +1,5 @@
#
#Tue Aug 09 20:20:11 CDT 2016
#Wed Aug 10 19:27:32 CDT 2016
46J50.languagetoolchain.version=3.47
conf.ids=46J50,45J50
45J50.com-microchip-mplab-nbide-toolchainC18-C18LanguageToolchain.md5=f040cf8645fa8ca680d9fc0f051bbb98