Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ThiefSil
flame-node
Commits
3ea44671
Commit
3ea44671
authored
6 months ago
by
도혁 함
Browse files
Options
Downloads
Patches
Plain Diff
chore: 주석 최종 수정
parent
b707a0b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
flame.c
+11
-12
11 additions, 12 deletions
flame.c
with
11 additions
and
12 deletions
flame.c
+
11
−
12
View file @
3ea44671
...
...
@@ -8,7 +8,7 @@
#include
<time.h>
#include
<signal.h>
/
/
상수 정의
/
*
상수 정의
*/
#define BUFFER_MAX 3 // 버퍼 크기
#define DIRECTION_MAX 256 // 방향 경로 최대 길이
#define VALUE_MAX 256 // 값 경로 최대 길이
...
...
@@ -26,10 +26,10 @@
#define RED 22 // 적색 LED 핀
#define BUZZER 27 // 부저 핀
// 부저 알림용 음계 배열
int
fireAlarmNotes
[]
=
{
880
,
880
,
0
,
880
,
880
,
0
,
988
,
988
,
0
,
880
,
880
,
0
};
// 전역 변수
int
fireAlarmNotes
[]
=
{
880
,
880
,
0
,
880
,
880
,
0
,
988
,
988
,
0
,
880
,
880
,
0
};
// 부저 알림용 음계 배열
/* 전역 변수 */
struct
sockaddr_in
server_addr
;
// 서버 주소 구조체
int
park
=
0
;
// 주차 상태: 0 = 비어있음, 1 = 주차됨
int
setFire
=
1
;
// 화재 상태: 1 = 정상, 0 = 화재 발생
...
...
@@ -37,10 +37,10 @@ int sock; // 소켓 디스크립터
int
redLed
=
2
;
// 초기 LED 상태
int
CLEAR
=
1
;
// 초기 화재 진압상태 1 = 화재 진압 상태 0 = 화재 미진압 상태
/* 스레드 변수 */
pthread_t
ultra_thread
,
flame_thread
,
receive_thread
;
// GPIO 핀 제어 함수 선언
pthread_t
ultra_thread
,
flame_thread
,
receive_thread
;
// 스레드 변수
/* GPIO 핀 제어 함수 선언 */
int
GPIOExport
(
int
pin
);
int
GPIOUnexport
(
int
pin
);
int
GPIODirection
(
int
pin
,
int
dir
);
...
...
@@ -182,7 +182,7 @@ void *receive_message(void *arg) {
buffer
[
valread
]
=
'\0'
;
printf
(
"서버로부터 받은 메시지: %s
\n
"
,
buffer
);
buffer
[
strcspn
(
buffer
,
"
\r\n
"
)]
=
'\0'
;
if
(
strcmp
(
buffer
,
"CLEAR"
)
==
0
)
{
// CLEAR 명령어 처리
if
(
strcmp
(
buffer
,
"CLEAR"
)
==
0
)
{
setFire
=
1
;
CLEAR
=
1
;
printf
(
"setFire 및 CLEAR가 %d, %d로 설정되었습니다.
\n
"
,
setFire
,
CLEAR
);
...
...
@@ -194,8 +194,7 @@ void *receive_message(void *arg) {
}
int
main
()
{
/* SIGINT 신호 (Ctrl + C) 처리 핸들러 등록 */
signal
(
SIGINT
,
(
void
*
)
signal_handler
);
signal
(
SIGINT
,
(
void
*
)
signal_handler
);
// SIGINT 신호 (Ctrl + C) 처리 핸들러 등록
/* 소켓 생성 */
if
((
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment