1
0

Merge pull request #1 from HEI-SYND-227-PTR/fix-fore-wired

Fix for wired
This commit is contained in:
Rémi Heredero 2024-04-27 10:26:07 +02:00 committed by GitHub
commit bfdc39ece1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 140 additions and 59 deletions

16
.gitignore vendored
View File

@ -83,3 +83,19 @@
.vscode/settings.json
.vscode/uv4.log
.vscode/uv4.log.lock
RTE/CMSIS/RTX_Config.c.update@5.1.1
RTE/CMSIS/RTX_Config.h.update@5.5.2
RTE/Compiler/EventRecorderConf.h.update@1.1.0
RTE/Device/STM32F746NGHx/RTE_Device.h.update@1.5.1
RTE/Device/STM32F746NGHx/startup_stm32f746xx.s.update@1.2.2
RTE/Device/STM32F746NGHx/stm32f7xx_hal_conf.h.update@1.2.7
RTE/Device/STM32F746NGHx/system_stm32f7xx.c.update@1.2.2
RTE/Hesso_pack/ext_buttons.c.base@1.0.0
RTE/Hesso_pack/ext_buttons.h.base@1.0.0
RTE/Hesso_pack/ext_keyboard.c.update@1.1.1
RTE/Hesso_pack/ext_keyboard.h.update@1.1.1
RTE/Hesso_pack/ext_led.c.base@1.0.0
RTE/Hesso_pack/ext_led.h.base@1.0.0
RTE/Hesso_pack/ext_uart.c.base@1.0.0
RTE/Hesso_pack/ext_uart.h.base@1.0.0
RTE/uGFX_library/gfxconf.h.update@2.0.0

View File

@ -23,6 +23,8 @@ void send_DATA_IND(Adresse source, Adresse destination, uint8_t* dataFramePtr) {
}
strPtr[dataFramePtr[2]] = '\0'; // null-terminate string
queueMsg.anyPtr = strPtr;
//retCode = osMemoryPoolFree(memPool, dataFramePtr);
//CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
switch (destination.sapi) {
case TIME_SAPI:

View File

@ -15,7 +15,8 @@ const osMessageQueueAttr_t queue_macData_attr = {
void sendToken() {
struct queueMsg_t queueMsg;
queueMsg.anyPtr = lastToken;
queueMsg.anyPtr = osMemoryPoolAlloc(memPool,osWaitForever);
memcpy(queueMsg.anyPtr, lastToken, TOKENSIZE-2);
queueMsg.type = TO_PHY;
osStatus_t retCode = osMessageQueuePut(
queue_phyS_id,
@ -60,6 +61,8 @@ void MacSender(void *argument) {
//----------------------------------------------------------------------
case TOKEN: {
// Get token and save it
// osDelay(300);
//lastToken = osMemoryPoolAlloc(memPool,osWaitForever);
memcpy(lastToken, msg, TOKENSIZE-2);
// update token
@ -70,13 +73,16 @@ void MacSender(void *argument) {
// send to lcd
queueMsg.type = TOKEN_LIST;
queueMsg.anyPtr = lastToken;
memcpy(queueMsg.anyPtr , lastToken, TOKENSIZE-2);
retCode = osMessageQueuePut(
queue_lcd_id,
&queueMsg,
osPriorityNormal,
osWaitForever);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
retCode = osMemoryPoolFree(memPool, queueMsg.anyPtr);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
// Send one msg from internal queue if exist
//if (osMemoryPoolGetCount(queue_macData_id) != 0) { // Message in Queue
@ -196,7 +202,8 @@ void MacSender(void *argument) {
}
gTokenInterface.station_list[gTokenInterface.myAddress] = (0x1 << TIME_SAPI) + (gTokenInterface.connected << CHAT_SAPI);
lastToken[gTokenInterface.myAddress+1] = gTokenInterface.station_list[gTokenInterface.myAddress];
sendToken();
/*
queueMsg.type = TO_PHY;
queueMsg.anyPtr = lastToken;
@ -206,6 +213,7 @@ void MacSender(void *argument) {
osPriorityNormal,
osWaitForever);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
*/
break;
}
@ -237,19 +245,17 @@ void MacSender(void *argument) {
src.nothing = 0;
length = strlen(queueMsg.anyPtr);
if(dst.addr != BROADCAST_ADDRESS) {
if(dst.addr == BROADCAST_ADDRESS) {
status.read = 1;
status.ack = 1;
stationStatus.raw = 0;
} else {
status.read = 0;
status.ack = 0;
stationStatus.raw = gTokenInterface.station_list[dst.addr];
}
if( (stationStatus.chat == 1) || (dst.addr == BROADCAST_ADDRESS)) {
if(dst.addr == BROADCAST_ADDRESS) {
status.read = 1;
status.ack = 1;
} else {
status.read = 0;
status.ack = 0;
}
if( (dst.addr == BROADCAST_ADDRESS) || (stationStatus.chat == 1)) {
msg = osMemoryPoolAlloc(memPool, 0);
if(msg == NULL) {
@ -274,7 +280,6 @@ void MacSender(void *argument) {
assert(false);
}
memcpy(lastSentMsgPtr, msg, length+4);
// TODO test if station is online
}
queueMsg.anyPtr = msg;

2
main.h
View File

@ -16,7 +16,7 @@
//--------------------------------------------------------------------------------
// Constants to change the system behavior
//--------------------------------------------------------------------------------
#define DEBUG_MODE 1 // mode is physical line (0) or debug (1)
#define DEBUG_MODE 0 // mode is physical line (0) or debug (1)
#define MYADDRESS 3 // your address choice (table number)
#define MAX_BLOCK_SIZE 100 // size max for a frame

View File

@ -157,9 +157,41 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>18</LineNumber>
<LineNumber>108</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134311450</Address>
<Address>134255386</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\108</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>110</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134255394</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\110</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>116</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134254758</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
@ -168,44 +200,28 @@
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_receiver.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_receiver.c\18</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>264</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134256144</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\264</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>86</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134255102</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\86</Expression>
<Expression>\\tokenring_project\mac_receiver.c\116</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>199</LineNumber>
<LineNumber>89</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134255344</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\89</Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>92</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
@ -219,10 +235,42 @@
<Expression></Expression>
</Bp>
<Bp>
<Number>4</Number>
<Number>5</Number>
<Type>0</Type>
<LineNumber>109</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>6</Number>
<Type>0</Type>
<LineNumber>111</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>7</Number>
<Type>0</Type>
<LineNumber>199</LineNumber>
<EnabledFlag>1</EnabledFlag>
<EnabledFlag>0</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
@ -239,27 +287,37 @@
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>sai</ItemText>
<ItemText>gTokenInterface</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>gTokenInterface</ItemText>
<ItemText>t</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>t</ItemText>
<ItemText>lastToken,0x10</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>lastToken</ItemText>
<ItemText>memPool</ItemText>
</Ww>
<Ww>
<count>4</count>
<WinNumber>1</WinNumber>
<ItemText>memPool</ItemText>
<ItemText>qPtr[0]</ItemText>
</Ww>
<Ww>
<count>5</count>
<WinNumber>1</WinNumber>
<ItemText>qPtr[1]</ItemText>
</Ww>
<Ww>
<count>6</count>
<WinNumber>1</WinNumber>
<ItemText>qPtr[2]</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
@ -294,7 +352,7 @@
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>